home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / CodeGen_Files / Msvc70.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  87.3 KB  |  2,815 lines

  1. // NeuroSolutions v4.2
  2.  
  3. // Copyright (c) 1994, NeuroDimension, Inc. All rights reserved.
  4. // Author: Wesley Curtis Lefebvre
  5.  
  6. #ifndef __GLOBAL_H__
  7. #define __GLOBAL_H__
  8.  
  9. #define PC
  10. #define MS_VISUAL
  11.  
  12. #include <stdio.h>
  13. #include <float.h>
  14. #include <string.h>
  15. #include <stdlib.h>
  16. #include <time.h>
  17. #include <math.h>
  18. #include <ctype.h>
  19.  
  20. #define WEIGHTFILEVERSION                225
  21. #define nil                                     NULL
  22. #define YES                                     1
  23. #define NO                                      0
  24. #define MAX(x,y)                        x>y?x:y;
  25. #define MIN(x,y)                        x<y?x:y;
  26. #define PI                                      3.1415927
  27. #define NSInt                           int
  28. #define NSUInt                          UINT
  29. #define NSLong                          long
  30. #define NSFloat                         float
  31.  
  32. #define NSSEEK_CUR                      1
  33. #define NSSEEK_END                      2
  34. #define NSSEEK_SET                      0
  35.  
  36. #ifndef PC
  37. #define SWAP
  38. #endif
  39.  
  40. #ifdef MS_VISUAL
  41. #define finite                          _finite
  42. #else
  43. #define finite(x)                       ((x>-1.0e12) && (x<1.0e12))
  44. #endif
  45.  
  46. #define DLL_PARAM_ROWS          5
  47. #define DLL_PARAM_COLS          3
  48.  
  49. #ifndef FALSE
  50. #define FALSE                           0
  51. #endif
  52. #ifndef TRUE
  53. #define TRUE                            1
  54. #endif
  55. #ifndef NULL
  56. #define NULL                            0
  57. #endif
  58.  
  59. //#ifdef _DEBUG
  60. //      #define malloc \
  61. //              NSMalloc
  62. //      #define calloc \
  63. //              NSCalloc
  64. //      #define free \
  65. //              NSFreeMemory
  66. //#endif
  67.  
  68. #ifndef NS_GUI
  69. typedef int     BOOL;
  70. #endif
  71.  
  72. typedef struct {
  73.         NSFloat *data;
  74.         int length;
  75. } DLLWeights;
  76.  
  77. typedef struct {
  78.         char parameters[DLL_PARAM_ROWS][DLL_PARAM_COLS][64];
  79.         char parameterNames[DLL_PARAM_ROWS][DLL_PARAM_COLS][64];
  80.         BOOL parameterReallocs[DLL_PARAM_ROWS][DLL_PARAM_COLS];
  81. } DLLParameters;
  82.  
  83. typedef struct {
  84.         DLLWeights *weights;
  85.         DLLParameters *parameters;
  86.         void *userData;
  87. } DLLData;
  88.  
  89. typedef struct {
  90.         void    *function,
  91.                         *constructor,
  92.                         *destructor;
  93.         DLLData *instance;
  94. } DLLStruct;
  95.  
  96. typedef DLLData         *(*DLL_Constructor)(DLLData *);
  97. typedef DLLData         *(*DLL_Constructor_CSW)(DLLData *, void *);
  98. typedef void            (*DLL_Destructor)(DLLData *);
  99. typedef void            (*DLL_Destructor_CSW)(DLLData *, void *);
  100.  
  101. //void* NSMalloc(size_t);
  102. //void* NSCalloc(size_t, size_t);
  103. //void NSFreeMemory(void*);
  104. //UINT NSBytesAllocated();
  105. unsigned short int getWeightFileVersion(FILE *file);
  106. FILE *seekComponent(FILE *, const char *, const char *);
  107. FILE *seekComponentReturnNull(FILE *, const char *, const char *);
  108. FILE *putComponent(FILE *, const char *, const char *);
  109. void writeWeightFileVersion(FILE *);
  110.  
  111. #endif __GLOBAL_H__
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. // Author: Wesley Curtis Lefebvre
  128.  
  129. #ifndef __NSDLL_H__
  130. #define __NSDLL_H__
  131.  
  132. void checkParameterIndices(int *row,int *col);
  133. DLLData *allocDLLInstance(DLLData *oldInstance);
  134. void freeDLLInstance(DLLData *instance);
  135. DLLData *setWeights(DLLData *instance, int numberOfWeights);
  136. DLLData *allocParameters(DLLData *instance);
  137. NSFloat *getWeights(DLLData *instance);
  138. void setUserData(DLLData *instance, void *userData);
  139. void *getUserData(DLLData *instance);
  140. void setParameterName(DLLData *instance, int row, int col, char *name, BOOL realloc);
  141. int getIntParameter(DLLData *instance, int row, int col);
  142. NSFloat getFloatParameter(DLLData *instance, int row, int col);
  143. char *getStringParameter(DLLData *instance, int row, int col);
  144. BOOL getBoolParameter(DLLData *instance, int row, int col);
  145. void setIntParameter(DLLData *instance, int row, int col, int intValue, BOOL force);
  146. void setFloatParameter(DLLData *instance, int row, int col, NSFloat floatValue, BOOL force);
  147. void setStringParameter(DLLData *instance, int row, int col, char *stringValue, BOOL force);
  148. void setBoolParameter(DLLData *instance, int row, int col, BOOL boolValue, BOOL force);
  149.  
  150. #endif __NSDLL_H__
  151.  
  152. // Author: Wesley Curtis Lefebvre
  153.  
  154. #ifndef __SpatialAccess_H__
  155. #define __SpatialAccess_H__
  156.  
  157.  
  158. class SpatialAccess
  159. {
  160. protected:
  161.         SpatialAccess *stackedAccess;
  162.         BOOL m_bTesting, m_bAccessTesting;
  163. public:
  164.         static BOOL    m_bRefreshAccess;
  165.         NSFloat *data;
  166.         int rowCount, colCount, spatialCount;
  167.         SpatialAccess();
  168.         BOOL accessTesting() { return m_bAccessTesting; };
  169.         void attachTo(SpatialAccess *);
  170.         int cols() { return colCount; };
  171.         virtual void reportSpatialAccess();
  172.         virtual void reportSpatialAccess(NSFloat *);
  173.         virtual void reportSpatialData();
  174.         int S() { return spatialCount; };
  175.         NSFloat &S(int i) { return *(data + i); };
  176.         NSFloat &S(int i, int j) { return *(data + j + i*cols()); };
  177.         int rows() { return rowCount; };
  178.         void setAccessTesting(BOOL aBOOL) { m_bAccessTesting = aBOOL; };
  179.         virtual void setData(NSFloat *, int, int=1);
  180.         virtual void setStackedAccess(SpatialAccess *);
  181.         void setTesting(BOOL aFlag) { m_bTesting = aFlag; };
  182.         BOOL testing() { return m_bTesting; };
  183.         virtual ~SpatialAccess();
  184. };
  185.  
  186. #endif // __SpatialAccess_H__
  187.  
  188. // Author: Wesley Curtis Lefebvre
  189.  
  190. #ifndef __SpatialData_H__
  191. #define __SpatialData_H__
  192.  
  193.  
  194. class SpatialData: public SpatialAccess
  195. {
  196. protected:
  197.         NSFloat         *allocatedData,
  198.                         randomRange;
  199. public:
  200.         BOOL            m_bAccessEnabled;
  201.  
  202. public:
  203.         SpatialData();
  204.         void assignScalar(NSFloat);
  205.         void copyDataFrom(NSFloat *);
  206.         void copyDataFromDouble(NSFloat *);
  207.         void copyDataTo(NSFloat *);
  208.         virtual void deleteData();
  209.         virtual void oversizeSpatialDimension(int);
  210.         void randomize();
  211.         virtual void setSpatialDimension(int, int=1);
  212.         void zero();
  213.         ~SpatialData();
  214. };
  215.  
  216. #endif // __SpatialData_H__
  217.  
  218.  
  219. #ifndef __InputSpatialData_h__
  220. #define __InputSpatialData_h__
  221.  
  222. class InputSpatialData: public SpatialData
  223. {
  224. protected:
  225.         BOOL    m_bPerformNormalization;
  226.         int     m_iAllocatedChannels;
  227.         NSFloat    *m_fDenormalizedData;
  228. public:
  229.         NSFloat   *m_fAmplitude,
  230.                 *m_fOffset;
  231. public:
  232.                 InputSpatialData();
  233.                 ~InputSpatialData();
  234. //        NSFloat &litude(int i) { return *(m_fAmplitude+i); };
  235.         void    denormalizeData();
  236.         void    loadWeights(FILE *file, unsigned short int version);
  237.         void    normalizeData();
  238. //        NSFloat &offset(int i) { return *(m_fOffset+i); };
  239.         void    saveWeights(FILE *file);
  240.         void    setPerformNormalization(BOOL aBool) { m_bPerformNormalization = aBool; };
  241.         void    setSpatialDimension(int rowInt, int colInt);
  242. };
  243.  
  244. #endif // __InputSpatialData_h__
  245.  
  246. // File.h
  247. // by David Scott Samson
  248.  
  249. #ifndef __File_h__
  250. #define __File_h__
  251.  
  252.  
  253. enum MODE       {ASCII = 0, BINARY, STANDARD };
  254. enum RW         {WRITE = 0, READ };
  255.  
  256. class File: public InputSpatialData
  257. {
  258. protected:
  259.         FILE    *m_pFileStream;
  260.         char    m_sFilePath[1024];
  261.         MODE    m_iMode;
  262.         RW      m_readWrite;
  263.         BOOL    m_AdvanceStream,
  264.                 m_StreamConstant,
  265.                 m_FixStream;
  266.         int     m_iDitherInput;
  267.         NSFloat   m_fDither;
  268. public:
  269.                 File();
  270.                 File(char *, RW=READ, MODE=BINARY);
  271.                 ~File();
  272.         void    advanceStream();
  273.         BOOL    closeFile();
  274.         void    ditherInput(int, NSFloat aFloat=0.1f);
  275.         char    *filePath(){return m_sFilePath;};
  276.         void    fixStream(BOOL);
  277.         int     mode() {return m_iMode;};
  278.         BOOL    openFile();
  279.         void    reportSpatialData();
  280.         void    setMode(RW, MODE);
  281.         void    setFilePath(char *);
  282. };
  283.  
  284. #endif // __File_h__
  285.  
  286. #ifndef __DLLInput_H__
  287. #define __DLLInput_H__
  288.  
  289.  
  290. typedef DLLData *(*DLLInput_Constructor)(DLLData *, int, int);
  291. typedef DLLData *(*DLLInput_Constructor_CSW)(DLLData *, int, int, void *);
  292. typedef void (*DLLInput_MAP)(DLLData *, NSFloat *, int, int);
  293. typedef void (*DLLInput_MAP_CSW)(DLLData *, NSFloat *, int, int, void *);
  294.  
  295. class DLLInput : public InputSpatialData
  296. {
  297. protected:
  298.         DLLStruct                       *dllStruct;
  299.         void                            *m_pCallingObject;
  300. public:
  301.                                                 DLLInput();
  302.         void                            reportSpatialData();
  303.         virtual void            constructDLL();
  304.         virtual void            destroyDLL(DLLData *);
  305.         virtual void            initializeDLL();
  306.         void                            setData(NSFloat *, int, int);
  307.         void                            setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  308.         void                            setSpatialDimension(int, int);
  309. };
  310.  
  311. #endif __DLLInput_H__
  312.  
  313. #ifndef __DLLPreprocessor_H__
  314. #define __DLLPreprocessor_H__
  315.  
  316.  
  317. typedef DLLData *(*DLLPreprocessor_Constructor)(DLLData *, int*, int*, BOOL);
  318. typedef DLLData *(*DLLPreprocessor_Constructor_CSW)(DLLData *, int*, int*, BOOL, void *);
  319. typedef BOOL (*DLLPreprocessor_MAP)(DLLData *, NSFloat *, NSFloat *, int, int, BOOL);
  320. typedef BOOL (*DLLPreprocessor_MAP_CSW)(DLLData *, NSFloat *, NSFloat *, int, int, BOOL, void *);
  321.  
  322. class DLLPreprocessor : public DLLInput
  323. {
  324. protected:
  325.         class   SpatialData     *m_pData;
  326.                 BOOL            m_bInputDataLocal;
  327. public:
  328.                                 DLLPreprocessor();
  329.                                 ~DLLPreprocessor();
  330.         void                    constructDLL();
  331.         virtual BOOL            isPreprocessor();
  332.         void                    reportSpatialData();
  333.         void                    setInputData(SpatialData *);
  334. };
  335.  
  336. #endif __DLLPreprocessor_H__
  337.  
  338. #ifndef __DLLPostprocessor_H__
  339. #define __DLLPostprocessor_H__
  340.  
  341.  
  342. class DLLPostprocessor : public DLLPreprocessor
  343. {
  344. public:
  345.                                                 DLLPostprocessor();
  346.         BOOL                            isPreprocessor();
  347.         void                            reportSpatialData();
  348. };
  349.  
  350. #endif __DLLPostprocessor_H__
  351.  
  352. // Author: Wesley Curtis Lefebvre
  353.  
  354. #ifndef __Soma_H__
  355. #define __Soma_H__
  356.  
  357.  
  358. class Soma {
  359.         friend class Axon;
  360.         friend class Synapse;
  361.         friend class BackAxon;
  362.         friend class BackSynapse;
  363.         int cells;
  364. protected:
  365.         NSFloat *cell, *t, *T, *link, *bufPosition;
  366.         int inputCells, outputCells, links, dllLinks;
  367.         NSFloat m_fWeightVariance, m_fWeightMean;
  368.         int somaTemporalDimension;
  369.         BOOL m_bWeightsFixed, m_bFreeCell, m_bWeightsLocallyAllocated;
  370.         void *m_pCallingObject;
  371. public:
  372.         Soma *Next;
  373.         SpatialAccess *activityAccess, *linkAccess, *dllLinkAccess;
  374.         DLLStruct *dllStruct;
  375.         Soma();
  376.         virtual ~Soma(void);
  377.         virtual void epochEnded();
  378.         virtual void loadWeights(FILE *, unsigned short int version=100);
  379.         virtual void loadStateVariables(FILE *file, unsigned short int version);
  380.         virtual void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  381.         virtual void saveStateVariables(FILE *file);
  382.         // DLL Stuff
  383.         virtual const char *dllFunctionName();
  384.         virtual void constructDLL(void);
  385.         virtual void destroyDLL(DLLData *);
  386.         virtual void initializeDLL(void);
  387.         virtual void setDLLFunction(DLLStruct *);
  388.         virtual void setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  389.         //
  390.         NSFloat weightMean(void) { return m_fWeightMean;} ;
  391.         NSFloat weightVariance(void) { return m_fWeightVariance;} ;
  392.         BOOL weightsFixed(void) { return m_bWeightsFixed;} ;
  393.         void setWeightMean(NSFloat);
  394.         void setWeightVariance(NSFloat);
  395.         void setWeightsFixed(BOOL aBOOL) { m_bWeightsFixed = aBOOL; };
  396.         virtual void rangeLinks(void);
  397.         virtual void zeroState(void) {};
  398.         virtual void networkReset(void);
  399.         virtual BOOL isAnAxon(void) { return FALSE; };
  400.         virtual BOOL isASynapse(void) { return FALSE; };
  401.         virtual void storeBufPosition(void);
  402.         virtual void recallBufPosition(void);
  403.         virtual void allocateLinks(int _links, BOOL force=FALSE);
  404.         void assignLinks(NSFloat *newLink, BOOL freeLater=TRUE);
  405.         void attachTo(Soma *aSoma, int delay);
  406.         void decrement(void) { if ((t -= cells) < cell) t = T - cells; };
  407.         virtual void decrementTime(void);
  408.         void deleteLinks(void);
  409.         virtual void fire(void);
  410.         virtual void fireDummy(void);
  411.         void increment(void) { if ((t += cells) >= T) t = cell; };
  412.         virtual void incrementTime(void);
  413.         virtual void networkJog(void);
  414.         virtual void networkRandomize(void);
  415.         virtual void activityAltered(void);
  416.         virtual void linksAltered(void);
  417.         virtual void setInputCells(int numberOfCells);
  418.         void setActivityAccess(SpatialAccess *);
  419.         void setLinkAccess(SpatialAccess *);
  420.         void setDLLLinkAccess(SpatialAccess *);
  421.         virtual void removeLast(Soma *) {};
  422.         virtual void removeNext(Soma *) {};
  423.         virtual void setLast(Soma *) {};
  424.         virtual void setNext(Soma *) {};
  425.         virtual void setOutputCells(int numberOfCells);
  426.         virtual void setTemporalDimension(int T);
  427.         int temporalDimension(void) { return somaTemporalDimension; };
  428.         int U(void) {return inputCells;};
  429.         int V(void) {return outputCells;};
  430.         NSFloat &V(int i) {return *(t+i);};
  431.         NSFloat &w(int i) {return *(link+i);};
  432.         int w(void) {return links;};
  433.         int W(void) {return links+dllLinks;};
  434.         BOOL weightsLocallyAllocated() { return m_bWeightsLocallyAllocated; };
  435.         NSFloat *weightVector() { return link; };
  436. };
  437.  
  438. #endif // __Soma_H__
  439.  
  440. // Author: Wesley Curtis Lefebvre
  441. // Name:        Axon.h
  442.  
  443. #ifndef __Axon_H__
  444. #define __Axon_H__
  445.  
  446.  
  447. typedef void (*Axon_MAP)(DLLData *, NSFloat *, int, int);
  448. typedef void (*Axon_MAP_CSW)(DLLData *, NSFloat *, int, int, void *);
  449. typedef DLLData *(*Axon_Constructor)(DLLData *, int, int);
  450. typedef DLLData *(*Axon_Constructor_CSW)(DLLData *, int, int, void *);
  451.  
  452. class Axon: public Soma {
  453. protected:
  454.         int m_iRows, m_iCols;
  455.         int dummyFiredCounter, firedCounter, lastCount, m_iInputNeurons;
  456.         Soma *forcedLast;
  457.         BOOL m_bFireNext, m_bFireNextOnReset, m_bFirePending;
  458.         NSFloat *m_pIPInputBuffer;
  459. public:
  460.         int nextCount;
  461.         Soma *nextConnection[128];
  462. public:
  463.         SpatialAccess *preActivityAccess;
  464.         Axon();
  465.         void activityAltered(void);
  466.         void loadWeights(FILE *, unsigned short int version=100);
  467.         void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  468.         int cols() { return m_iCols; };
  469.         void constructDLL(void);
  470.         void fire(void);
  471.         void fireDummy(void);
  472.         const char *dllFunctionName();
  473.         virtual void fireDLL(void);
  474.         virtual void fireFeed(void);
  475.         virtual void fireMap(void);
  476.         BOOL fireNext(void) { return m_bFireNext; };
  477.         void incrementTime(void);
  478.         virtual void initialize(void);
  479.         BOOL isAnAxon(void) { return TRUE; };
  480.         virtual void networkReset();
  481.         void removeForcedLast(Soma *) { forcedLast=NULL; };
  482.         void removeLast(Soma *aSoma);
  483.         void removeNext(Soma *aSoma);
  484.         int rows() { return m_iRows; };
  485.         void setCols(int);
  486.         void setDLLFunction(DLLStruct *);
  487.         void setFireNext(BOOL aBOOL) { m_bFireNext = aBOOL; };
  488.         void setFireNextOnReset(BOOL aBOOL) { m_bFireNextOnReset = aBOOL; };
  489.         void setForcedLast(Soma *aSoma) { forcedLast=aSoma; };
  490.         void setInputCells(int numberOfCells);
  491.         void setIPInputBuffer(NSFloat *aBuffer) { m_pIPInputBuffer = aBuffer; };
  492.         void setLast(Soma *aSoma);
  493.         void setNext(Soma *nextSoma);
  494.         void setOutputCells(int numberOfCells);
  495.         void setPreActivityAccess(SpatialAccess *);
  496.         void setRows(int);
  497.         void setTemporalDimension(int T);
  498. //      NSFloat &V(int i, int j) { return V(j + i*m_iCols); };
  499.         ~Axon(void);
  500. };
  501.  
  502. #endif // __Axon_H__
  503. /*
  504. #ifndef __ExpanderAxon_H__
  505. #define __ExpanderAxon_H__
  506.  
  507. class ExpanderAxon: public Axon {
  508. protected:
  509.             int            m_nExpansionFactor;
  510. public:
  511.                         ExpanderAxon();
  512.             int            expansionFactor() { return m_nExpansionFactor; };
  513.             void        fireMap(void);
  514.             void        setInputCells(int anInt);
  515.             void        setExpansionFactor(int anInt) { if (m_nExpansionFactor != anInt) {m_nExpansionFactor = anInt; initialize();} };
  516. };
  517.  
  518. #endif // __ExpanderAxon_H__
  519. */
  520.  
  521. #ifndef __FuzzyAxon_H__
  522. #define __FuzzyAxon_H__
  523.  
  524. typedef void (*FuzzyAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *);
  525. typedef void (*FuzzyAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, void *);
  526. typedef DLLData *(*FuzzyAxon_Constructor)(DLLData *, int, int, int *);
  527. typedef DLLData *(*FuzzyAxon_Constructor_CSW)(DLLData *, int, int, int *, void *);
  528.  
  529. class FuzzyAxon: public Axon {
  530. public:
  531.             int            m_nMFCount;
  532. protected:
  533.             int                *m_WinningMF;
  534.             NSFloat            *m_WinningInput;
  535.             NSFloat            *m_MFOutput;
  536.             SpatialAccess   *MFOutputAccess;
  537. public:
  538.             BOOL            m_bOldFuzzyFormat;
  539. public:
  540.                         FuzzyAxon();
  541.                         ~FuzzyAxon();
  542.             void        activityAltered(void);
  543.     virtual NSFloat        applyMF(int paramIndex, NSFloat x) = 0;
  544.             void        constructDLL(void);
  545.             const char    *dllFunctionName();
  546.             void        fireDLL(void);
  547.             void        fireMap(void);
  548.             NSFloat        firingStrength(int index, BOOL callDLL = FALSE);
  549.             void        initialize();
  550.             int            MFMapping(int inputIndex, int outputIndex); //Comment for Single Connection
  551.             int            MFCount() { return m_nMFCount; };
  552.     virtual int            MFParameters() = 0;
  553.             void        setInputCells(int anInt);
  554.             void        setMFCount(int anInt) { if (m_nMFCount != anInt) {m_nMFCount = anInt; initialize();} };
  555.             void        setMFOutputAccess(SpatialAccess *aNSAccess);
  556.             void        setOldFuzzyFormat(BOOL aBool) { m_bOldFuzzyFormat = aBool; };
  557.             NSFloat        winningInput(int i) { return *(m_WinningInput + i); };
  558.             int            winningMF(int i) { return *(m_WinningMF + i); };
  559. };
  560.  
  561. #endif // __FuzzyAxon_H__
  562.  
  563. #ifndef __BellFuzzyAxon_H__
  564. #define __BellFuzzyAxon_H__
  565.  
  566. class BellFuzzyAxon: public FuzzyAxon {
  567.  
  568. public:
  569.             NSFloat        applyMF(int paramIndex, NSFloat x);
  570.             int            MFParameters() { return 3; };
  571.             void        networkRandomize();
  572. };
  573.  
  574. #endif // __BellFuzzyAxon_H__
  575.  
  576. #ifndef __GaussianFuzzyAxon_H__
  577. #define __GaussianFuzzyAxon_H__
  578.  
  579. class GaussianFuzzyAxon: public FuzzyAxon {
  580.  
  581. public:
  582.             NSFloat        applyMF(int paramIndex, NSFloat x);
  583.             int            MFParameters() { return 2; };
  584.             void        networkRandomize();
  585. };
  586.  
  587. #endif // __GaussianFuzzyAxon_H__
  588.  
  589. #ifndef __CombinerAxon_H__
  590. #define __CombinerAxon_H__
  591.  
  592. class CombinerAxon: public Axon {
  593. public:
  594.                         CombinerAxon();
  595.             void        activityAltered(void);
  596.             void        fireMap(void);
  597.             void        setInputCells(int anInt);
  598. };
  599.  
  600. #endif // __CombinerAxon_H__
  601.  
  602.  
  603. //NormalizedAxon
  604.  
  605. #ifndef __NormalizedAxon_H__
  606. #define __NormalizedAxon_H__
  607.  
  608. class NormalizedAxon: public Axon {
  609. private:
  610.     NSFloat        *m_WeightingFactorArray;
  611.     int            m_nWeightingFactorArraySize;
  612.  
  613. public:
  614.                 NormalizedAxon() { m_nWeightingFactorArraySize = 0; m_WeightingFactorArray = NULL; };
  615.                 ~NormalizedAxon() {     if (m_WeightingFactorArray) free(m_WeightingFactorArray); };
  616.     void        fireMap(void);
  617.     NSFloat        *weightingFactorArray() { return m_WeightingFactorArray; };
  618. };
  619.  
  620. #endif // __NormalizedAxon_H__
  621.  
  622.  
  623. // Author: Wesley Curtis Lefebvre
  624.  
  625. #ifndef __BiasAxon_H__
  626. #define __BiasAxon_H__
  627.  
  628.  
  629. typedef void (*BiasAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *);
  630. typedef void (*BiasAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, void *);
  631.  
  632. class BiasAxon: public Axon {
  633. protected:
  634.         void fireInline(register NSFloat &f, register NSFloat &fw) { f += fw; };
  635. public:
  636.         const char *dllFunctionName();
  637.         void fireDLL(void);
  638.         void fireMap(void);
  639.         void initialize(void);
  640. };
  641.  
  642. #endif // __BiasAxon_H__
  643.  
  644.  
  645. // Author: Wesley Curtis Lefebvre
  646.  
  647. #ifndef __LinearAxon_H__
  648. #define __LinearAxon_H__
  649.  
  650.  
  651. typedef void (*LinearAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat);
  652. typedef void (*LinearAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat, void *);
  653.  
  654. class LinearAxon: public BiasAxon {
  655. protected:
  656.         NSFloat m_fBeta;
  657. public:
  658.         LinearAxon();
  659.         NSFloat beta() { return m_fBeta; };
  660.         const char *dllFunctionName();
  661.         void fireInline(register NSFloat &f, register NSFloat &fw) { f *= m_fBeta; BiasAxon::fireInline(f,fw); };
  662.         void fireDLL(void);
  663.         void fireMap();
  664.         virtual void setBeta(NSFloat aFloat) { m_fBeta = aFloat; };
  665. };
  666.  
  667. #endif // __LinearAxon_H__
  668.  
  669. // Author: Wesley Curtis Lefebvre
  670.  
  671. #ifndef __SigmoidAxon_H__
  672. #define __SigmoidAxon_H__
  673.  
  674.  
  675. class SigmoidAxon: public LinearAxon {
  676. public:
  677.         void fireInline(register NSFloat &f, register NSFloat &fw) { LinearAxon::fireInline(f,fw); f = 1.0f/(1.0f+(NSFloat)exp(-f));};
  678.         void fireMap(void);
  679. };
  680.  
  681. #endif // __SigmoidAxon_H__
  682.  
  683.  
  684. //NormalizedSigmoidAxon
  685.  
  686. #ifndef __NormalizedSigmoidAxon_H__
  687. #define __NormalizedSigmoidAxon_H__
  688.  
  689. class NormalizedSigmoidAxon: public SigmoidAxon {
  690. private:
  691.     NSFloat        *m_WeightingFactorArray;
  692.     int            m_nWeightingFactorArraySize;
  693.  
  694. public:
  695.                 NormalizedSigmoidAxon() { m_nWeightingFactorArraySize = 0; m_WeightingFactorArray = NULL; };
  696.                 ~NormalizedSigmoidAxon() {     if (m_WeightingFactorArray) free(m_WeightingFactorArray); };
  697.     void        fireMap(void);
  698.     NSFloat        *weightingFactorArray() { return m_WeightingFactorArray; };
  699. };
  700.  
  701. #endif // __NormalizedSigmoidAxon_H__
  702.  
  703.  
  704. // Author: Wesley Curtis Lefebvre
  705.  
  706. #ifndef __TanhAxon_H__
  707. #define __TanhAxon_H__
  708.  
  709.  
  710. class TanhAxon: public LinearAxon {
  711. public:
  712.         void fireInline(register NSFloat &f, register NSFloat &fw) { LinearAxon::fireInline(f,fw); f = (NSFloat)tanh(f); };
  713.         void fireMap(void);
  714. };
  715.  
  716. #endif // __TanhAxon_H__
  717.  
  718. // Author: Wesley Curtis Lefebvre
  719.  
  720. #ifndef __LinearSigmoidAxon_H__
  721. #define __LinearSigmoidAxon_H__
  722.  
  723.  
  724. class LinearSigmoidAxon: public SigmoidAxon {
  725. public:
  726.         void fireInline(register NSFloat &f, register NSFloat &fw) { BiasAxon::fireInline(f,fw); f *= m_fBeta; if (f<0.0f) f=0.0f; else if (f>1.0f) f=1.0f; };
  727.         void fireMap(void);
  728. };
  729.  
  730. #endif // __LinearSigmoidAxon_H__
  731.  
  732. // Author: Wesley Curtis Lefebvre
  733.  
  734. #ifndef __LinearTanhAxonAxon_H__
  735. #define __LinearTanhAxonAxon_H__
  736.  
  737.  
  738. class LinearTanhAxon: public TanhAxon {
  739. public:
  740.         void fireInline(register NSFloat &f, register NSFloat &fw) { BiasAxon::fireInline(f,fw); f *= m_fBeta; if (f<-1.0f) f=-1.0f; else if (f>1.0f) f=1.0f; };
  741.         void fireMap(void);
  742. };
  743.  
  744. #endif // __LinearTanhAxonAxon_H__
  745.  
  746. // Author: Wesley Curtis Lefebvre
  747.  
  748. #ifndef __SoftMaxAxon_H__
  749. #define __SoftMaxAxon_H__
  750.  
  751.  
  752. class SoftMaxAxon: public LinearAxon {
  753. public:
  754.         SoftMaxAxon();
  755.         void fireInline(register NSFloat &f, register NSFloat &fw) { f = 1.0f; };
  756.         void fireMap(void);
  757. };
  758.  
  759. #endif // __SoftMaxAxon_H__
  760.  
  761. // Author: Wesley Curtis Lefebvre
  762.  
  763. #ifndef __WinnerTakeAllAxon_H__
  764. #define __WinnerTakeAllAxon_H__
  765.  
  766.  
  767. class WinnerTakeAllAxon: public Axon {
  768. protected:
  769.         BOOL    m_bMaxWinner;
  770.         SpatialAccess    *winningPEAccess;
  771.         NSFloat            m_fWinningPE;
  772.  
  773. public:
  774.         WinnerTakeAllAxon();
  775.         ~WinnerTakeAllAxon();
  776.         void fireMap(void);
  777.         BOOL maxWinner() { return m_bMaxWinner; };
  778.         void setMaxWinner(BOOL aBOOL) { m_bMaxWinner = aBOOL; };
  779.         void setWinningPEAccess(SpatialAccess *anId);
  780. };
  781.  
  782. #endif // __WinnerTakeAllAxon_H__
  783.  
  784. // Author: Wesley Curtis Lefebvre
  785.  
  786. #ifndef __ThresholdAxon_H__
  787. #define __ThresholdAxon_H__
  788.  
  789.  
  790. class ThresholdAxon: public BiasAxon {
  791. public:
  792.         void fireInline(register NSFloat &f, register NSFloat &fw) { BiasAxon::fireInline(f,fw); f = f>0? 1.0f: -1.0f; };
  793.         void fireMap(void);
  794. };
  795.  
  796. #endif // __ThresholdAxon_H__
  797.  
  798. // Author: Wesley Curtis Lefebvre
  799.  
  800. #ifndef __GaussianAxon_H__
  801. #define __GaussianAxon_H__
  802.  
  803.  
  804. class GaussianAxon: public LinearAxon {
  805. protected:
  806.         class FullSynapse *m_pFullSynapse;
  807.         int     m_iNeighbors, m_iMetric;
  808.         BOOL    m_bBetaDataLocal, m_bNormalize;
  809. public:
  810.         class SpatialData *variance;
  811.         GaussianAxon();
  812.         ~GaussianAxon();
  813.         void assignCenters();
  814.         void assignVariance();
  815.         void fireInline(NSFloat &f, NSFloat &fw, NSFloat &fv) { BiasAxon::fireInline(f,fw); f = (NSFloat)exp(-fv*f*f); };
  816.         void fireMap(void);
  817.         void initialize();
  818.         void loadWeights(FILE *, unsigned short int version=100);
  819.         void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  820.         int neighbors() { return m_iNeighbors; };
  821.         int metric() { return m_iMetric; };
  822.         void setBeta(NSFloat);
  823.         void setBetaData(SpatialData *);
  824.         void setMetric(int anInt) { m_iMetric = anInt; };
  825.         void setNeighbors(int);
  826.         void setFullSynapse(FullSynapse *anId) { m_pFullSynapse = anId; };
  827.         void setNormalize(BOOL aBool) { m_bNormalize = aBool; };
  828.         BOOL normalize() { return m_bNormalize; };
  829. };
  830.  
  831. #endif // __GaussianAxon_H__
  832.  
  833. // Author: Wesley Curtis Lefebvre
  834.  
  835. #ifndef __TDNNAxon_H__
  836. #define __TDNNAxon_H__
  837.  
  838.  
  839. typedef void (*TDNNAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int);
  840. typedef void (*TDNNAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, void *);
  841. typedef DLLData *(*TDNNAxon_Constructor)(DLLData *, int, int, int);
  842. typedef DLLData *(*TDNNAxon_Constructor_CSW)(DLLData *, int, int, int, void *);
  843.  
  844. class TDNNAxon: public Axon {
  845.         Soma *delayedReference;
  846. protected:
  847.         int memoryTaps, delay;
  848. public:
  849.         TDNNAxon();
  850.         void activityAltered(void);
  851.         void setTemporalDimension(int T);
  852.         void loadWeights(FILE *, unsigned short int version=100);
  853.         void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  854.         const char *dllFunctionName();
  855.         void fireDLL(void);
  856.         void fireMap(void);
  857.         void initialize(void);
  858.         void constructDLL(void);
  859.         void incrementTime(void);
  860.         void decrementTime(void);
  861.         void loadStateVariables(FILE *file, unsigned short int version);
  862.         void saveStateVariables(FILE *file);
  863.         void recallBufPosition(void);
  864.         void setDelay(int anInt);
  865.         void setInputCells(int anInt);
  866.         void setOutputCells(int anInt);
  867.         void setMemoryTaps(int anInt);
  868.         void setTapDelay(int anInt);
  869.         void setTaps(int anInt);
  870.         void storeBufPosition(void);
  871.         int tapDelay(void) { return delay; };
  872.         int taps(void) { return memoryTaps; };
  873.         NSFloat &Vd(int i) { return delayedReference->V(i); };
  874.         void zeroState(void);
  875.         ~TDNNAxon(void);
  876. };
  877.  
  878. #endif // __TDNNAxon_H__
  879.  
  880. // Author: Wesley Curtis Lefebvre
  881.  
  882. #ifndef __GammaAxon_H__
  883. #define __GammaAxon_H__
  884.  
  885.  
  886. typedef void (*GammaAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *);
  887. typedef void (*GammaAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *, void *);
  888.  
  889. class GammaAxon: public TDNNAxon {
  890. public:
  891.         const char *dllFunctionName();
  892.         void fireDLL(void);
  893.         void fireMap(void);
  894.         void initialize(void);
  895.         void networkRandomize(void);
  896.         void rangeLinks(void);
  897. };
  898.  
  899. #endif // __GammaAxon_H__
  900.  
  901. // Author: Wesley Curtis Lefebvre
  902.  
  903. #ifndef __LaguarreAxon_H__
  904. #define __LaguarreAxon_H__
  905.  
  906.  
  907. class LaguarreAxon: public GammaAxon {
  908. public:
  909.         void initialize(void);
  910.         void fireMap(void);
  911.         void networkRandomize(void);
  912.         void rangeLinks(void);
  913. };
  914.  
  915. #endif // __LaguarreAxon_H__
  916.  
  917. // Author: Wesley Curtis Lefebvre
  918.  
  919. #ifndef __ContextAxon_H__
  920. #define __ContextAxon_H__
  921.  
  922.  
  923. typedef void (*ContextAxon_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat);
  924. typedef void (*ContextAxon_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat, void *);
  925.  
  926. class ContextAxon: public LinearAxon {
  927.         Soma *delayedReference;
  928. protected:
  929.         int delay;
  930. public:
  931.         ContextAxon();
  932.         const char *dllFunctionName();
  933.         void fireDLL(void);
  934.         void fireMap(void);
  935.         void incrementTime(void);
  936.         void decrementTime(void);
  937.         void initialize(void);
  938.         void rangeLinks();
  939.         void recallBufPosition(void);
  940.         void loadStateVariables(FILE *file, unsigned short int version);
  941.         void saveStateVariables(FILE *file);
  942.         void storeBufPosition(void);
  943.         NSFloat &Vd(int i) { return delayedReference->V(i); };
  944.         void zeroState(void);
  945.         ~ContextAxon(void);
  946. };
  947.  
  948. #endif // __ContextAxon_H__
  949.  
  950. // Author: Wesley Curtis Lefebvre
  951.  
  952. #ifndef __SigmoidContextAxon_H__
  953. #define __SigmoidContextAxon_H__
  954.  
  955.  
  956. class SigmoidContextAxon: public ContextAxon {
  957. public:
  958.         void fireMap();
  959. };
  960.  
  961. #endif // __SigmoidContextAxon_H__
  962.  
  963. // Author: Wesley Curtis Lefebvre
  964.  
  965. #ifndef __TanhContextAxon_H__
  966. #define __TanhContextAxon_H__
  967.  
  968.  
  969. class TanhContextAxon: public ContextAxon {
  970. public:
  971.         void fireMap();
  972. };
  973.  
  974. #endif // __TanhContextAxon_H__
  975.  
  976. // Author: Wesley Curtis Lefebvre
  977.  
  978. #ifndef __IntegratorAxon_H__
  979. #define __IntegratorAxon_H__
  980.  
  981.  
  982. class IntegratorAxon: public ContextAxon {
  983. public:
  984.         void fireMap(void);
  985. };
  986.  
  987. #endif // __IntegratorAxon_H__
  988.  
  989. // Author: Wesley Curtis Lefebvre
  990.  
  991. #ifndef __SigmoidIntegratorAxon_H__
  992. #define __SigmoidIntegratorAxon_H__
  993.  
  994.  
  995. class SigmoidIntegratorAxon: public IntegratorAxon {
  996. public:
  997.         void fireMap();
  998. };
  999.  
  1000. #endif // __SigmoidIntegratorAxon_H__
  1001.  
  1002. // Author: Wesley Curtis Lefebvre
  1003.  
  1004. #ifndef __TanhIntegratorAxon_H__
  1005. #define __TanhIntegratorAxon_H__
  1006.  
  1007.  
  1008. class TanhIntegratorAxon: public IntegratorAxon {
  1009. public:
  1010.         void fireMap();
  1011. };
  1012.  
  1013. #endif // __TanhIntegratorAxon_H__
  1014.  
  1015. // Author: Wesley Curtis Lefebvre
  1016.  
  1017. #ifndef __Synapse_H__
  1018. #define __Synapse_H__
  1019.  
  1020.  
  1021. typedef void (*Synapse_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int);
  1022. typedef void (*Synapse_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, void *);
  1023. typedef DLLData *(*Synapse_Constructor)(DLLData *, int, int, int, int);
  1024. typedef DLLData *(*Synapse_Constructor_CSW)(DLLData *, int, int, int, int, void *);
  1025.  
  1026. class Synapse: public Soma {
  1027. //      class NAccess *initializationAccess;
  1028. public:
  1029.         Axon *Last, *Feed;
  1030.         Synapse();
  1031.         ~Synapse();
  1032.         virtual void allocateSynapticLinks(void);
  1033.         void detachYourself(void);
  1034. //      void exemplarStarting(void) { initializationAccess->dataAt(&V(0)); };
  1035.         void constructDLL(void);
  1036.         const char *dllFunctionName();
  1037.         virtual void fireDLL();
  1038.         void fire(void);
  1039.         virtual void fireFeed(void);
  1040.         BOOL isASynapse(void) { return TRUE; };
  1041.         void loadStateVariables(FILE *file, unsigned short int version);
  1042.         void saveStateVariables(FILE *file);
  1043.         void removeLast(Soma *aSoma);
  1044.         void removeNext(Soma *aSoma);
  1045.         void retryConnections();
  1046.         void setDLLFunction(DLLStruct *);
  1047. //      void setInitializationAccess(NAccess *);
  1048.         void setInputCells(int numberOfCells) { Soma::setInputCells(U()); };
  1049.         void setLast(Soma *aSoma);
  1050.         void setOutputCells(int numberOfCells) { Soma::setOutputCells(V()); };
  1051.         void setNext(Soma *aSoma);
  1052.         void setTemporalDimension(int T);
  1053.         void zeroState();
  1054. };
  1055.  
  1056. #endif __Synapse_H__
  1057.  
  1058. // Author: Wesley Curtis Lefebvre
  1059.  
  1060. #ifndef __FullSynapse_H__
  1061. #define __FullSynapse_H__
  1062.  
  1063.  
  1064. typedef void (*FullSynapse_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *);
  1065. typedef void (*FullSynapse_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, void *);
  1066.  
  1067. class FullSynapse: public Synapse {
  1068. public:
  1069.         NSFloat &W(int i, int j) {return w(j+i*V());};
  1070.         void allocateSynapticLinks(void);
  1071.         const char *dllFunctionName();
  1072.         void linksAltered(void);
  1073.         void fireDLL();
  1074.         void fireFeed(void);
  1075. };
  1076.  
  1077. #endif // __FullSynapse_H__
  1078.  
  1079. // SVMOutputSynapse
  1080.  
  1081. #ifndef __SVMOutputSynapse_H__
  1082. #define __SVMOutputSynapse_H__
  1083.  
  1084.  
  1085. class SVMOutputSynapse: public FullSynapse {
  1086.  
  1087. protected:
  1088.     NSFloat            *m_fpDesiredMatrix;
  1089.     NSFloat            *m_fSVMBiasVector;
  1090.     BOOL            m_bRunningFirstEpoch;
  1091.  
  1092. public:
  1093.                     SVMOutputSynapse();
  1094.     NSFloat            biasElement(int outIndex) { return m_fSVMBiasVector ? *(m_fSVMBiasVector+outIndex) : 0.0f; };
  1095.     NSFloat            desiredElement(int outIndex, int exemplar) { return m_fpDesiredMatrix ? *(m_fpDesiredMatrix+outIndex*V()+exemplar) : 0.0f; };
  1096.     void            epochEnded();
  1097.     void            fireFeed(void);
  1098.     void            linksAltered(void);
  1099.     void            loadStateVariables(FILE *file, unsigned short int version);
  1100.     void            networkReset();
  1101.     void            saveStateVariables(FILE *file);
  1102.     void            setBiasElement(int outIndex, NSFloat aFloat) { if (m_fSVMBiasVector) *(m_fSVMBiasVector+outIndex) = aFloat; };
  1103.     void            setDesiredElement(int outIndex, int exemplar, NSFloat aFloat);
  1104.     void            setRunningFirstEpoch(BOOL aBool) { m_bRunningFirstEpoch = aBool; };
  1105.     BOOL            runningFirstEpoch() { return m_bRunningFirstEpoch; };
  1106.     void            updateSVMBiasElement(int outIndex, int exemplar, NSFloat dAlpha) { if (m_fSVMBiasVector && m_fpDesiredMatrix) *(m_fSVMBiasVector+outIndex) += *(m_fpDesiredMatrix+outIndex*V()+exemplar) * dAlpha; };
  1107. };
  1108.  
  1109. #endif // __SVMOutputSynapse_H__
  1110.  
  1111.  
  1112. // Author: Wesley Curtis Lefebvre
  1113.  
  1114. #ifndef __ArbitrarySynapse_H__
  1115. #define __ArbitrarySynapse_H__
  1116.  
  1117.  
  1118. class ArbitrarySynapse: public Synapse {
  1119.         class ConnectionList *connections;
  1120. public:
  1121.         ArbitrarySynapse();
  1122.         void loadWeights(FILE *, unsigned short int version=100);
  1123.         void saveWeights(FILE *, BOOL addLineFeed=TRUE);
  1124.         ConnectionList *connectionList(void) { return connections;};
  1125.         const char *dllFunctionName();
  1126.         void fireFeed();
  1127.         void freeConnectionList();
  1128.         void useConnectionList(ConnectionList *aList) { connections = aList; };
  1129. };
  1130.  
  1131. #endif // __ArbitrarySynapse_H__
  1132.  
  1133. // Author: Wesley Curtis Lefebvre
  1134. // Name: FunctionIO.h
  1135.  
  1136. #ifndef __FunctionIO_h__
  1137. #define __FunctionIO_h__
  1138.  
  1139.  
  1140. typedef void (*FunctionIO_MAP)(NSFloat *, int, int);
  1141. typedef void (*FunctionIO_MAP_CSW)(NSFloat *, int, int, void *);
  1142.  
  1143. class FunctionIO: public InputSpatialData
  1144. {
  1145. protected:
  1146.         void    *m_pFunction;
  1147.         void    *m_pCallingObject;
  1148.         RW      m_readWrite;
  1149. public:
  1150.                         FunctionIO();
  1151.         void    reportSpatialData();
  1152.         void    setFunction(void *aFunction, void *callingObject=NULL);
  1153.         void    setMode(RW readWrite);
  1154. };
  1155.  
  1156. #endif // __FunctionIO_h__
  1157.  
  1158. // Author: Wesley Curtis Lefebvre
  1159.  
  1160. #ifndef __BackAxon_H__
  1161. #define __BackAxon_H__
  1162.  
  1163.  
  1164. typedef void (*BackAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *);
  1165. typedef void (*BackAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, void *);
  1166. typedef DLLData *(*BackAxon_Constructor)(DLLData *, DLLData *, int, int);
  1167. typedef DLLData *(*BackAxon_Constructor_CSW)(DLLData *, DLLData *, int, int, void *);
  1168.  
  1169. class BackAxon: public Axon {
  1170. protected:
  1171.         BOOL gradientsEnabled;
  1172.         NSFloat *m_fWeightingVector;
  1173.         int m_nWeightingVectorSize;
  1174.         int m_nCurrentExemplar;
  1175. public:
  1176.         Axon *Dual;
  1177. public:
  1178.         BackAxon();
  1179.         void activityAltered();
  1180.         void linksAltered();
  1181.         virtual void backpropComplete();
  1182.         void backpropStarting();
  1183.         void constructDLL();
  1184.         void networkRandomize();
  1185.         void setBackpropOffset(int);
  1186.         void setCurrentExemplar(int exemplar);
  1187.         virtual void setDual(Soma *);
  1188.         void setGradientsEnabled(BOOL);
  1189.         void setWeightingVector(NSFloat *aVector, int vectorSize);
  1190.         void updateExemplarCounter();
  1191.         // Overridden virtual functions
  1192.         const char *dllFunctionName();
  1193.         void fireDLL();
  1194.         void fire();
  1195.         void incrementTime();
  1196.         void setInputCells(int) { Soma::setInputCells(U()); };
  1197.         void setOutputCells(int) { Soma::setOutputCells(V()); };
  1198. };
  1199.  
  1200. #endif // __BackAxon_H__
  1201.  
  1202. //BackFuzzyAxon
  1203.  
  1204. #ifndef __BackFuzzyAxon_H__
  1205. #define __BackFuzzyAxon_H__
  1206.  
  1207. typedef void (*BackFuzzyAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, int, int, NSFloat, NSFloat *);
  1208. typedef void (*BackFuzzyAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, int, int, NSFloat, NSFloat *, void *);
  1209.  
  1210. class BackFuzzyAxon: public BackAxon {
  1211. public:
  1212.     // DLL Code Here
  1213.             void        activityAltered(void);
  1214.             NSFloat        computeDerivative(int weightIndex, int outputIndex, BOOL dllActive);
  1215.             const char *dllFunctionName();
  1216.     virtual    NSFloat        derivative(int weightIndex, int outputIndex) = 0;
  1217.             void        fireDLL(void);
  1218.             void        fireMap();
  1219.             void        initialize();
  1220. };
  1221.  
  1222. #endif // __BackFuzzyAxon_H__
  1223.  
  1224. //BackBellFuzzyAxon
  1225.  
  1226. #ifndef __BackBellFuzzyAxon_H__
  1227. #define __BackBellFuzzyAxon_H__
  1228.  
  1229. class BackBellFuzzyAxon: public BackFuzzyAxon {
  1230. public:
  1231.     // DLL Code Here
  1232.     NSFloat        derivative(int weightIndex, int outputIndex);
  1233. };
  1234.  
  1235. #endif // __BackBellFuzzyAxon_H__
  1236.  
  1237. //BackGaussianFuzzyAxon
  1238.  
  1239. #ifndef __BackGaussianFuzzyAxon_H__
  1240. #define __BackGaussianFuzzyAxon_H__
  1241.  
  1242. class BackGaussianFuzzyAxon: public BackFuzzyAxon {
  1243. public:
  1244.     // DLL Code Here
  1245.     NSFloat        derivative(int weightIndex, int outputIndex);
  1246. };
  1247.  
  1248. #endif // __BackGaussianFuzzyAxon_H__
  1249.  
  1250. //BackCombinerAxon
  1251.  
  1252. #ifndef __BackCombinerAxon_H__
  1253. #define __BackCombinerAxon_H__
  1254.  
  1255. class BackCombinerAxon: public BackAxon {
  1256. public:
  1257.     void        fireMap(void);
  1258. };
  1259.  
  1260. #endif // __BackCombinerAxon_H__
  1261.  
  1262.  
  1263. //BackNormalizedAxon
  1264.  
  1265. #ifndef __BackNormalizedAxon_H__
  1266. #define __BackNormalizedAxon_H__
  1267.  
  1268. class BackNormalizedAxon: public BackAxon {
  1269. public:
  1270.     void fireMap(void);
  1271. };
  1272.  
  1273. #endif // __BackNormalizedAxon_H__
  1274.  
  1275.  
  1276. // Author: Wesley Curtis Lefebvre
  1277.  
  1278. #ifndef __BackBiasAxon_H__
  1279. #define __BackBiasAxon_H__
  1280.  
  1281.  
  1282. typedef void (*BackBiasAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *);
  1283. typedef void (*BackBiasAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, void *);
  1284.  
  1285. class BackBiasAxon: public BackAxon {
  1286. public:
  1287.         const char *dllFunctionName();
  1288.         void fireDLL();
  1289.         void fireMap();
  1290.         void initialize();
  1291. };
  1292.  
  1293. #endif // __BackBiasAxon_H__
  1294.  
  1295. // Author: Wesley Curtis Lefebvre
  1296.  
  1297. #ifndef __BackLinearAxon_H__
  1298. #define __BackLinearAxon_H__
  1299.  
  1300.  
  1301. typedef void (*BackLinearAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *,NSFloat);
  1302. typedef void (*BackLinearAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *,NSFloat,void *);
  1303.  
  1304. class BackLinearAxon: public BackBiasAxon {
  1305. protected:
  1306.         NSFloat m_fOffset;
  1307.         class LinearAxon *linearAxon() { return (LinearAxon*)Dual; };
  1308. public:
  1309.         BackLinearAxon();
  1310.         const char *dllFunctionName();
  1311.         void fireDLL();
  1312.         void fireMap();
  1313.         NSFloat offset() { return m_fOffset; };
  1314.         void setOffset(NSFloat aFloat) { m_fOffset = aFloat; };
  1315. };
  1316.  
  1317. #endif // __BackLinearAxon_H__
  1318.  
  1319. // Author: Wesley Curtis Lefebvre
  1320.  
  1321. #ifndef __BackSigmoidAxon_H__
  1322. #define __BackSigmoidAxon_H__
  1323.  
  1324.  
  1325. class BackSigmoidAxon: public BackLinearAxon {
  1326. public:
  1327.         void fireMap();
  1328. };
  1329.  
  1330. #endif // __BackSigmoidAxon_H__
  1331.  
  1332. //BackNormalizedSigmoidAxon
  1333.  
  1334. #ifndef __BackNormalizedSigmoidAxon_H__
  1335. #define __BackNormalizedSigmoidAxon_H__
  1336.  
  1337. class BackNormalizedSigmoidAxon: public BackSigmoidAxon {
  1338. public:
  1339.     void fireMap(void);
  1340. };
  1341.  
  1342. #endif // __BackNormalizedSigmoidAxon_H__
  1343.  
  1344. // Author: Wesley Curtis Lefebvre
  1345.  
  1346. #ifndef __BackTanhAxon_H__
  1347. #define __BackTanhAxon_H__
  1348.  
  1349.  
  1350. class BackTanhAxon: public BackLinearAxon {
  1351. public:
  1352.         void fireMap();
  1353. };
  1354.  
  1355. #endif // __BackTanhAxon_H__
  1356.  
  1357. // Author: Wesley Curtis Lefebvre
  1358.  
  1359. #ifndef __BackTDNNAxon_H__
  1360. #define __BackTDNNAxon_H__
  1361.  
  1362.  
  1363. typedef void (*BackTDNNAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *);
  1364. typedef void (*BackTDNNAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *, void *);
  1365. typedef DLLData *(*BackTDNNAxon_Constructor)(DLLData *, DLLData *, int, int, int);
  1366. typedef DLLData *(*BackTDNNAxon_Constructor_CSW)(DLLData *, DLLData *, int, int, int, void *);
  1367.  
  1368. class BackTDNNAxon: public BackAxon {
  1369.         Soma *delayedReference;
  1370. protected:
  1371.         int memoryTaps;
  1372. public:
  1373.         BackTDNNAxon();
  1374.         void activityAltered(void);
  1375.         void backpropComplete();
  1376.         void constructDLL(void);
  1377.         const char *dllFunctionName();
  1378.         void fireDLL();
  1379.         void fireMap(void);
  1380.         void incrementTime(void);
  1381.         void initialize(void);
  1382.         void loadStateVariables(FILE *file, unsigned short int version);
  1383.         void saveStateVariables(FILE *file);
  1384.         void setMemoryTaps(int anInt);
  1385.         int taps(void) { return memoryTaps; };
  1386.         NSFloat &Vd(int i) { return delayedReference->V(i); };
  1387.         void zeroState(void);
  1388.         ~BackTDNNAxon(void);
  1389. };
  1390.  
  1391. #endif // __BackTDNNAxon_H__
  1392.  
  1393. // Author: Wesley Curtis Lefebvre
  1394.  
  1395. #ifndef __BackGammaAxon_H__
  1396. #define __BackGammaAxon_H__
  1397.  
  1398.  
  1399. typedef void (*BackGammaAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *, NSFloat *, NSFloat *);
  1400. typedef void (*BackGammaAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, NSFloat *, NSFloat *, NSFloat *, void *);
  1401.  
  1402. class BackGammaAxon: public BackTDNNAxon {
  1403. public:
  1404.         const char *dllFunctionName();
  1405.         void fireDLL();
  1406.         void fireMap(void);
  1407.         void initialize(void);
  1408. };
  1409.  
  1410. #endif // __BackGammaAxon_H__
  1411.  
  1412. // Author: Wesley Curtis Lefebvre
  1413. // Name:        Connection.h
  1414.  
  1415. #ifndef __Connection_h__
  1416. #define __Connection_h__
  1417.  
  1418.  
  1419. class Connection {
  1420.         int fromIndex, *toIndices, toCount, toAllocated;
  1421. public:
  1422.         Connection();
  1423.         ~Connection();
  1424.         void addConnection(int index);
  1425.         void allocateConnections(int number);
  1426.         int *connections(void) { return toIndices; };
  1427.         int count(void) { return toCount; };
  1428.         void empty(void);
  1429.         int feedingIndex(void) { return fromIndex; };
  1430.         void insertConnectionAt(int toIndex, int index);
  1431.         void removeConnection(int index);
  1432.         void setIndex(int index) {fromIndex = index; };
  1433.         Connection &operator=(Connection &aConnection);
  1434. };
  1435.  
  1436. #endif // __Connection_h__
  1437.  
  1438. // Author: Wesley Curtis Lefebvre
  1439.  
  1440. #ifndef __ConnectionList_h__
  1441. #define __ConnectionList_h__
  1442.  
  1443.  
  1444. class ConnectionList {
  1445.         class Connection **synapse;
  1446.         int synapseCount, synapseAllocated;
  1447. public:
  1448.         ConnectionList();
  1449.         ~ConnectionList(void);
  1450.         void addConnection(int fromIndex, int toIndex);
  1451.         void allocateSynapse(int number);
  1452.         Connection *connectionAt(int index) { return synapse[index]; };
  1453.         int count(void) { return synapseCount; };
  1454.         void empty(void);
  1455.         void insertConnectionAt(int fromIndex, int toIndex, int index);
  1456.         void removeConnection(int fromIndex, int toIndex);
  1457.         int weights(void);
  1458. };
  1459.  
  1460. #endif // __ConnectionList_h__
  1461.  
  1462. // Author: Wesley Curtis Lefebvre
  1463.  
  1464. #ifndef __BackLaguarreAxon_H__
  1465. #define __BackLaguarreAxon_H__
  1466.  
  1467.  
  1468. class BackLaguarreAxon: public BackGammaAxon {
  1469. public:
  1470.         void fireMap(void);
  1471.         void initialize(void);
  1472. };
  1473.  
  1474. #endif // __BackLaguarreAxon_H__
  1475.  
  1476. // Author: Wesley Curtis Lefebvre
  1477.  
  1478. #ifndef __BackContextAxon_H__
  1479. #define __BackContextAxon_H__
  1480.  
  1481.  
  1482. typedef void (*BackContextAxon_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat *, NSFloat, NSFloat *);
  1483. typedef void (*BackContextAxon_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat *, NSFloat, NSFloat *, void *);
  1484.  
  1485. class BackContextAxon: public BackLinearAxon {
  1486. protected:
  1487.         Soma *delayedReference;
  1488.         NSFloat m_fOffset;
  1489. public:
  1490.         BackContextAxon();
  1491.         const char *dllFunctionName();
  1492.         void fireDLL(void);
  1493.         void fireMap(void);
  1494.         void incrementTime(void);
  1495.         void initialize(void);
  1496.         void loadStateVariables(FILE *file, unsigned short int version);
  1497.         void saveStateVariables(FILE *file);
  1498.         NSFloat &Vd(int i) { return delayedReference->V(i); };
  1499.         void zeroState(void);
  1500.         ~BackContextAxon(void);
  1501. };
  1502.  
  1503. #endif // __BackContextAxon_H__
  1504.  
  1505. // Author: Wesley Curtis Lefebvre
  1506.  
  1507. #ifndef __BackSigmoidContextAxon_H__
  1508. #define __BackSigmoidContextAxon_H__
  1509.  
  1510.  
  1511. class BackSigmoidContextAxon: public BackContextAxon {
  1512. public:
  1513.         void fireMap(void);
  1514. };
  1515.  
  1516. #endif // __BackSigmoidContextAxon_H__
  1517.  
  1518. // Author: Wesley Curtis Lefebvre
  1519.  
  1520. #ifndef __BackTanhContextAxon_H__
  1521. #define __BackTanhContextAxon_H__
  1522.  
  1523.  
  1524. class BackTanhContextAxon: public BackContextAxon {
  1525. public:
  1526.         void fireMap(void);
  1527. };
  1528.  
  1529. #endif // __BackTanhContextAxon_H__
  1530.  
  1531. // Author: Wesley Curtis Lefebvre
  1532.  
  1533. #ifndef __BackIntegratorAxon_H__
  1534. #define __BackIntegratorAxon_H__
  1535.  
  1536.  
  1537. class BackIntegratorAxon: public BackContextAxon {
  1538. public:
  1539.         void fireMap(void);
  1540. };
  1541.  
  1542. #endif // __BackIntegratorAxon_H__
  1543.  
  1544. // Author: Wesley Curtis Lefebvre
  1545.  
  1546. #ifndef __BackSigmoidIntegratorAxon_H__
  1547. #define __BackSigmoidIntegratorAxon_H__
  1548.  
  1549.  
  1550. class BackSigmoidIntegratorAxon: public BackIntegratorAxon {
  1551. public:
  1552.         void fireMap(void);
  1553. };
  1554.  
  1555. #endif // __BackSigmoidIntegratorAxon_H__
  1556.  
  1557. // Author: Wesley Curtis Lefebvre
  1558.  
  1559. #ifndef __BackTanhIntegratorAxon_H__
  1560. #define __BackTanhIntegratorAxon_H__
  1561.  
  1562.  
  1563. class BackTanhIntegratorAxon: public BackIntegratorAxon {
  1564. public:
  1565.         void fireMap(void);
  1566. };
  1567.  
  1568. #endif // __BackTanhIntegratorAxon_H__
  1569.  
  1570. // Author: Wesley Curtis Lefebvre
  1571.  
  1572. #ifndef __BackSynapse_H__
  1573. #define __BackSynapse_H__
  1574.  
  1575.  
  1576. typedef void (*BackSynapse_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *);
  1577. typedef void (*BackSynapse_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, void *);
  1578. typedef DLLData *(*BackSynapse_Constructor)(DLLData *, DLLData *, int, int, int, int);
  1579. typedef DLLData *(*BackSynapse_Constructor_CSW)(DLLData *, DLLData *, int, int, int, int, void *);
  1580.  
  1581. class BackSynapse: public Synapse {
  1582. protected:
  1583.         BOOL gradientsEnabled;
  1584.         NSFloat *m_fWeightingVector;
  1585.         int m_nWeightingVectorSize;
  1586.         int m_nCurrentExemplar;
  1587. public:
  1588.         Synapse *Dual;
  1589. public:
  1590.         BackSynapse();
  1591.         void activityAltered();
  1592.         const char *dllFunctionName();
  1593.         void fireDLL();
  1594.         void linksAltered();
  1595.         void backpropComplete();
  1596.         void backpropStarting();
  1597.         void constructDLL();
  1598.         void networkRandomize();
  1599.         virtual void setDual(Soma *);
  1600.         void setCurrentExemplar(int exemplar);
  1601.         void setGradientsEnabled(BOOL);
  1602.         void setWeightingVector(NSFloat *aVector, int vectorSize);
  1603.         void updateExemplarCounter();
  1604.         // Overridden virtual functions
  1605.         void fire();
  1606.         void incrementTime();
  1607. };
  1608.  
  1609. #endif // __BackSynapse_H__
  1610.  
  1611. // Author: Wesley Curtis Lefebvre
  1612.  
  1613. #ifndef __BackFullSynapse_H__
  1614. #define __BackFullSynapse_H__
  1615.  
  1616.  
  1617. typedef void (*BackFullSynapse_MAP)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat *);
  1618. typedef void (*BackFullSynapse_MAP_CSW)(DLLData *, DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat *, NSFloat *, void *);
  1619.  
  1620. class BackFullSynapse: public BackSynapse {
  1621. protected:
  1622.         NSFloat &W(int i, int j) { return Dual->w(i+j*U()); };
  1623. public:
  1624.         void allocateSynapticLinks();
  1625.         const char *dllFunctionName();
  1626.         void fireDLL();
  1627.         void fireFeed();
  1628.         void linksAltered();
  1629. };
  1630.  
  1631. #endif // __BackFullSynapse_H__
  1632.  
  1633. // Author: Wesley Curtis Lefebvre
  1634.  
  1635. #ifndef __BackArbitrarySynapse_H__
  1636. #define __BackArbitrarySynapse_H__
  1637.  
  1638.  
  1639. class BackArbitrarySynapse: public BackSynapse {
  1640.         class ConnectionList *connections;
  1641. public:
  1642.         void allocateSynapticLinks(void);
  1643.         const char *dllFunctionName();
  1644.         void fireFeed(void);
  1645.         void setDual(Soma *aSoma);
  1646. };
  1647.  
  1648. #endif // __BackArbitrarySynapse_H__
  1649.  
  1650. // Author: Wesley Curtis Lefebvre
  1651.  
  1652. #ifndef __BackCriteriaControl_H__
  1653. #define __BackCriteriaControl_H__
  1654.  
  1655.  
  1656. class BackCriteriaControl: public BackAxon {
  1657. protected:
  1658.         BOOL streamFixed;
  1659. protected:
  1660.         void fireMap();
  1661. public:
  1662.         BackCriteriaControl();
  1663.         const char *dllFunctionName();
  1664.         void fixStream(BOOL aFlag) { streamFixed = aFlag; };
  1665.         void incrementTime();
  1666. };
  1667.  
  1668. #endif // __BackCriteriaControl_H__
  1669.  
  1670. // Author: Wesley Curtis Lefebvre
  1671.  
  1672. #ifndef __Criterion_H__
  1673. #define __Criterion_H__
  1674.  
  1675.  
  1676. typedef NSFloat (*Criterion_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, BOOL);
  1677. typedef NSFloat (*Criterion_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, NSFloat *, BOOL, void *);
  1678.  
  1679. class Criterion: public Axon {
  1680.         int                                m_iSaveCounter,
  1681.                                         tempCounter,
  1682.                                         m_iCheckCostEvery,
  1683.                                         m_iSensitivityCounter;
  1684.         NSFloat                         *m_fWeightingVector;
  1685.         int                             m_nWeightingVectorSize;
  1686.         int                             m_nCurrentExemplar,
  1687.                                         m_nTotalNetworkWeights,
  1688.                                         m_nConfusionRows;
  1689. public:
  1690.         int                             costCounter;
  1691.         BOOL                            m_bIgnoreNextError;
  1692.         NSFloat                            *m_fOffsetVector;
  1693.  
  1694. protected:
  1695.         BOOL                            testing,
  1696.                                         m_bAutoSave,
  1697.                                         m_bOnIncrease,
  1698.                                         m_bTrainBestCostUpdated,
  1699.                                         m_bSensitivity;
  1700.         double                            *m_dfSumYY,
  1701.                                         *m_dfSumY,
  1702.                                         *m_dfTempSumY,
  1703.                                         *m_dfSumXY,
  1704.                                         *m_dfSumX,
  1705.                                         *m_dfSumXX,
  1706.                                         *m_dfTempSumXY,
  1707.                                         *m_dfTempSumX,
  1708.                                         *m_dfTempSumXX,
  1709.                                         *m_dfTempSumYY;
  1710.         NSFloat                         E,
  1711.                                         m_fRunningMSE,
  1712.                                         m_fTempRunningMSE,
  1713.                                         m_fTempPercentError,
  1714.                                         runningE,
  1715.                                         m_fPercentError,
  1716.                                         m_fConfusionThreshold,
  1717.                                         m_fCorrelationAverage,
  1718.                                         m_fNMSE,
  1719.                                         m_fAIC,
  1720.                                         m_fMDL,
  1721.                                         *m_fROC,
  1722.                                         *m_fTempConfusion,
  1723.                                         *m_fConfusion,
  1724.                                         *m_fPerformanceMeasures,
  1725.                                         *m_fConfusionAsPercent,
  1726.                                         *m_fCorrelation,
  1727.                                         m_fLastReportedTrainBestCost,
  1728.                                         m_fLastReportedTestBestCost,
  1729.                                         m_fLastReportedTestCost,
  1730.                                         m_fLastReportedTrainCost,
  1731.                                         m_fLastUncheckedCost,
  1732.                                         m_fBestCost,
  1733.                                         m_fLastCost,
  1734.                                         m_nROCMinValue,
  1735.                                         m_nROCMaxValue,
  1736.                                         tempE,
  1737.                                         *desired;
  1738.         SpatialAccess                   *costAccess,
  1739.                                         *runningCostAccess,
  1740.                                         *performanceMeasuresAccess,
  1741.                                         *confusionAccess,
  1742.                                         *rOCAccess,
  1743.                                         *confusionAsPercentAccess,
  1744.                                         *correlationAccess,
  1745.                                         *desiredAccess;
  1746.         SpatialData                     *m_pFixedOutput,
  1747.                                         *m_pSensitivity,
  1748.                                         *m_pRawSensitivity,
  1749.                                         *m_pSensitivityTotals;
  1750.         BOOL                            m_bSensitivityDataLocal,
  1751.                                         m_bRawSensitivityDataLocal,
  1752.                                         m_bSensitivityTotalsDataLocal;
  1753.         int                                m_nROCThresholds,
  1754.                                         m_nROCChannel,
  1755.                                         *m_nTempROCCounters,
  1756.                                         *m_nROCCounters;
  1757. public:
  1758.                                         Criterion();
  1759.                                         ~Criterion();
  1760.         BOOL                    autoSave() { return m_bAutoSave; };
  1761.         NSFloat                    bestCost() { return m_fBestCost; };
  1762.         BOOL                    checkForSaveBest(BOOL, NSFloat, BOOL);
  1763.         BOOL                    checkForSaveBest(NSFloat, BOOL);
  1764.         void                    computePerformanceStats();
  1765.         virtual void            determineCost();
  1766.         virtual void            determineCostDerivative()=0;
  1767.         const char              *dllFunctionName();
  1768.         void                    epochEnded();
  1769.         void                    fireDLL();
  1770.         virtual void            fireGetReady();
  1771.         void                    fireMap();
  1772.         void                    fireSensitivity();
  1773.         void                    incrementTime();
  1774.         void                    ignoreNextError();
  1775.         void                    initialize();
  1776.         NSFloat                    lastReportedTestCost() { return m_fLastReportedTestCost; };
  1777.         NSFloat                    lastReportedTrainCost() { return m_fLastReportedTrainCost; };
  1778.         NSFloat                    lastUncheckedCost() { return m_fLastUncheckedCost; };
  1779.         void                    networkRandomize();
  1780.         void                    networkReset();
  1781.         void                    phaseEnded(int counter);
  1782.         NSFloat                 reportCost(BOOL reportSpatial = TRUE, BOOL resetCounter = TRUE);
  1783.         void                    reportPerformanceAccess();
  1784.         int                        saveCounter() { return m_iSaveCounter; };
  1785.         BOOL                    sensitivity() { return m_bSensitivity; };
  1786.         void                    setAutoSave(BOOL aBool) { m_bAutoSave = aBool; };
  1787.         void                    setBestCost(NSFloat aFloat) { m_fBestCost = aFloat; };
  1788.         void                    setCheckCostEvery(int anInt) { m_iCheckCostEvery = anInt; };
  1789.         void                    setConfusionAccess(SpatialAccess* anId);
  1790.         void                    setConfusionAsPercentAccess(SpatialAccess* anId);
  1791.         void                    setConfusionThreshold(NSFloat aFloat) { m_fConfusionThreshold = aFloat; };
  1792.         void                    setCorrelationAccess(SpatialAccess* anId);
  1793.         void                    setCostAccess(SpatialAccess *);
  1794.         void                    setCurrentExemplar(int exemplar);
  1795.         void                    setDesiredAccess(SpatialAccess *);
  1796.         void                    setOnIncrease(BOOL aBool) { m_bOnIncrease = aBool; };
  1797.         void                    setOffsetVector(NSFloat *aFloatPointer) { m_fOffsetVector = aFloatPointer; }
  1798.         void                    setPerformanceMeasuresAccess(SpatialAccess *anId);
  1799.         void                    setRunningCostAccess(SpatialAccess *);
  1800.         void                    setRawSensitivityData(SpatialData *anId);
  1801.         void                    setROCAccess(SpatialAccess* anId);
  1802.         void                    setROCThresholds(int anInt) { m_nROCThresholds = anInt; initialize(); };
  1803.         void                    setROCChannel(int anInt) { m_nROCChannel = anInt; };
  1804.         void                    setROCMinValue(NSFloat aFloat) { m_nROCMinValue = aFloat; };
  1805.         void                    setROCMaxValue(NSFloat aFloat) { m_nROCMaxValue = aFloat; };
  1806.         void                    setSaveCounter(int anInt) { m_iSaveCounter = anInt; };
  1807.         void                    setSensitivityData(SpatialData *);
  1808.         void                    setSensitivityTotalsData(SpatialData *);
  1809.         void                    setSensitivity(BOOL);
  1810.         virtual NSFloat         setTesting(BOOL);
  1811.         void                    setTotalNetworkWeights(int anInt) { m_nTotalNetworkWeights = anInt; };
  1812.         void                    setSensitivityInputs(int);
  1813.         void                    setWeightingVector(NSFloat *aVector, int vectorSize);
  1814.         void                    updateWeightedCost();
  1815.         BOOL                    isTesting() { return testing; };
  1816. };
  1817.  
  1818. #endif // __Criterion_H__
  1819.  
  1820. // Author: Wesley Curtis Lefebvre
  1821.  
  1822. #ifndef __L1Criterion_H__
  1823. #define __L1Criterion_H__
  1824.  
  1825.  
  1826. class L1Criterion: public Criterion {
  1827. protected:
  1828.         void determineCost();
  1829.         void determineCostDerivative();
  1830. };
  1831.  
  1832. #endif // __L1Criterion_H__
  1833.  
  1834. // Author: Wesley Curtis Lefebvre
  1835.  
  1836. #ifndef __L2Criterion_H__
  1837. #define __L2Criterion_H__
  1838.  
  1839.  
  1840. class L2Criterion: public Criterion {
  1841. protected:
  1842.         void determineCost();
  1843.         void determineCostDerivative();
  1844. };
  1845.  
  1846. #endif // __L2Criterion_H__
  1847.  
  1848. // SVML2Criterion
  1849.  
  1850. #ifndef __SVML2Criterion_H__
  1851. #define __SVML2Criterion_H__
  1852.  
  1853.  
  1854. class SVML2Criterion: public L2Criterion {
  1855. private:
  1856.     SVMOutputSynapse        *m_pOutputSynapse;
  1857.     BOOL                    m_bRunningFirstEpoch;
  1858.     int                        m_nExemplarCount;
  1859.  
  1860. public:
  1861.             SVML2Criterion();
  1862.     void    determineCost();
  1863.     void    determineCostDerivative();
  1864.     void    epochEnded();
  1865.     int        exemplarCount() { return m_nExemplarCount; };
  1866.     void    loadStateVariables(FILE *file, unsigned short int version);
  1867.     void    networkReset();
  1868.     BOOL    runningFirstEpoch() { return m_bRunningFirstEpoch; };
  1869.     void    saveStateVariables(FILE *file);
  1870.     void    setSVMOutputSynapse(SVMOutputSynapse *aSynapse) { m_pOutputSynapse = aSynapse; };
  1871.     void    setExemplarCount(int anInt) { m_nExemplarCount = anInt; };
  1872.     void    setRunningFirstEpoch(BOOL aBool) { m_bRunningFirstEpoch = aBool; };
  1873.  
  1874. };
  1875.  
  1876. #endif // __SVML2Criterion_H__
  1877.  
  1878. // L2TemporalCriterion
  1879.  
  1880. #ifndef __L2TemporalCriterion_H__
  1881. #define __L2TemporalCriterion_H__
  1882.  
  1883.  
  1884. class L2TemporalCriterion: public Criterion {
  1885. protected:
  1886.     NSFloat                m_fLargeChangeRightDirectionScale,
  1887.                         m_fLargeChangeWrongDirectionScale,
  1888.                         m_fSmallChangeRightDirectionScale,
  1889.                         m_fSmallChangeWrongDirectionScale,
  1890.                         m_fRightDirectionScale,
  1891.                         m_fWrongDirectionScale,
  1892.                         m_fLargeChangeScale,
  1893.                         m_fSmallChangeScale,
  1894.                         *m_fLastActivity,
  1895.                         *m_fLastDesired,
  1896.                         m_fDiscountRate,
  1897.                         *m_fOverallScale;
  1898.     BOOL                m_bMagnitudeOfChange,
  1899.                         m_bDirectionOfChange,
  1900.                         m_bMemoryNeedsReallocating,
  1901.                         m_bDataPreDifferenced,
  1902.                         m_bRecencyOfObservation;
  1903.     int                    m_nActiveNumberOfExemplars,
  1904.                         m_nCVNumberOfExemplars,
  1905.                         m_nNumberOfExemplars,
  1906.                         m_nExemplarNumber,
  1907.                         m_nMode;
  1908.  
  1909.     void determineCost();
  1910.     void determineCostDerivative();
  1911.     NSFloat determineDirectionalProfitScale(NSFloat desired, NSFloat lastDesired, NSFloat activity, NSFloat lastActivity, NSFloat standardDeviation, NSFloat normalizationOffset);
  1912.     NSFloat determineDirectionScale(NSFloat desired, NSFloat lastDesired, NSFloat activity, NSFloat lastActivity, NSFloat normalizationOffset);
  1913.     NSFloat determineMagnitudeScale(NSFloat desired, NSFloat lastDesired, NSFloat standardDeviation);
  1914.     NSFloat determineRecencyScale();
  1915.     void initialize(void);
  1916.     void linksAltered(void);
  1917.  
  1918. public:
  1919.             L2TemporalCriterion();
  1920.             ~L2TemporalCriterion();
  1921.     void    epochEnded();
  1922.     void    fireGetReady();
  1923.     void    networkReset();
  1924.     NSFloat setTesting(BOOL);
  1925.     NSFloat    largeChangeRightDirectionScale() { return m_fLargeChangeRightDirectionScale; };
  1926.     NSFloat    largeChangeWrongDirectionScale() { return m_fLargeChangeWrongDirectionScale; };
  1927.     NSFloat    smallChangeRightDirectionScale() { return m_fSmallChangeRightDirectionScale; };
  1928.     NSFloat    smallChangeWrongDirectionScale() { return m_fSmallChangeWrongDirectionScale; };
  1929.     NSFloat    rightDirectionScale() { return m_fRightDirectionScale; };
  1930.     NSFloat    wrongDirectionScale() { return m_fWrongDirectionScale; };
  1931.     NSFloat    largeChangeScale() { return m_fLargeChangeScale; };
  1932.     NSFloat    smallChangeScale() { return m_fSmallChangeScale; };
  1933.     NSFloat    discountRate() { return m_fDiscountRate; };
  1934.     BOOL    magnitudeOfChange() { return m_bMagnitudeOfChange; };
  1935.     BOOL    directionOfChange() { return m_bDirectionOfChange; };
  1936.     BOOL    recencyOfObservation() { return m_bRecencyOfObservation; };
  1937.     BOOL    dataPreDifferenced() { return m_bDataPreDifferenced; };
  1938.     void    setActiveNumberOfExemplars(int anInt) { m_nActiveNumberOfExemplars = anInt; };
  1939.     void    setCVNumberOfExemplars(int anInt) { m_nCVNumberOfExemplars = anInt; };
  1940.     void    setLargeChangeRightDirectionScale(NSFloat aFloat) { m_fLargeChangeRightDirectionScale = aFloat; };
  1941.     void    setLargeChangeWrongDirectionScale(NSFloat aFloat) { m_fLargeChangeWrongDirectionScale = aFloat; };
  1942.     void    setSmallChangeRightDirectionScale(NSFloat aFloat) { m_fSmallChangeRightDirectionScale = aFloat; };
  1943.     void    setSmallChangeWrongDirectionScale(NSFloat aFloat) { m_fSmallChangeWrongDirectionScale = aFloat; };
  1944.     void    setRightDirectionScale(NSFloat aFloat) { m_fRightDirectionScale = aFloat; };
  1945.     void    setWrongDirectionScale(NSFloat aFloat) { m_fWrongDirectionScale = aFloat; };
  1946.     void    setLargeChangeScale(NSFloat aFloat) { m_fLargeChangeScale = aFloat; };
  1947.     void    setSmallChangeScale(NSFloat aFloat) { m_fSmallChangeScale = aFloat; };
  1948.     void    setDiscountRate(NSFloat aFloat) { m_fDiscountRate = aFloat; };
  1949.     void    setMagnitudeOfChange(BOOL aBool) { m_bMagnitudeOfChange = aBool; m_bMemoryNeedsReallocating = TRUE; m_nMode = ((int) m_bRecencyOfObservation) * 1 + ((int) m_bDirectionOfChange) * 2 + ((int) m_bMagnitudeOfChange) * 4; };
  1950.     void    setDirectionOfChange(BOOL aBool) { m_bDirectionOfChange = aBool; m_bMemoryNeedsReallocating = TRUE; m_nMode = ((int) m_bRecencyOfObservation) * 1 + ((int) m_bDirectionOfChange) * 2 + ((int) m_bMagnitudeOfChange) * 4; };
  1951.     void    setRecencyOfObservation(BOOL aBool) { m_bRecencyOfObservation = aBool; m_bMemoryNeedsReallocating = TRUE; m_nMode = ((int) m_bRecencyOfObservation) * 1 + ((int) m_bDirectionOfChange) * 2 + ((int) m_bMagnitudeOfChange) * 4; };
  1952.     void    setDataPreDifferenced(BOOL aBool) { m_bDataPreDifferenced = aBool; m_bMemoryNeedsReallocating = TRUE; };
  1953.     void    setExemplarNumber(int anInt) { m_nExemplarNumber = anInt; };
  1954. };
  1955.  
  1956. #endif // __L2TemporalCriterion_H__
  1957.  
  1958. // Author: Wesley Curtis Lefebvre
  1959.  
  1960. #ifndef __LpCriterion_H__
  1961. #define __LpCriterion_H__
  1962.  
  1963.  
  1964. class LpCriterion: public Criterion {
  1965.         int m_nP;
  1966. protected:
  1967.         void determineCost();
  1968.         void determineCostDerivative();
  1969. public:
  1970.         void setP(int anInt);
  1971.         int  p() { return m_nP; };
  1972.         LpCriterion();
  1973. };
  1974.  
  1975. #endif // __LpCriterion_H__
  1976.  
  1977. // Author: Wesley Curtis Lefebvre
  1978.  
  1979. #ifndef __LinfinityCriterion_H__
  1980. #define __LinfinityCriterion_H__
  1981.  
  1982.  
  1983. class LinfinityCriterion: public Criterion {
  1984. protected:
  1985.         void determineCost();
  1986.         void determineCostDerivative();
  1987. };
  1988.  
  1989. #endif // __LinfinityCriterion_H__
  1990.  
  1991. // Author: Wesley Curtis Lefebvre
  1992.  
  1993. #ifndef __Gradient_H__
  1994. #define __Gradient_H__
  1995.  
  1996.  
  1997. class Gradient {
  1998.         NSFloat maxWeight;
  1999. public:
  2000.         class Soma *errorSoma;
  2001.         class Soma *forwardSoma;
  2002. protected:
  2003.         DLLStruct *dllStruct;
  2004.         void *m_pCallingObject;
  2005.         Gradient **m_Gradient;
  2006.         Criterion *m_Criterion;
  2007.         int m_nGradientCount;
  2008. public:
  2009.         int linksAllocated;
  2010.         Gradient();
  2011.         virtual ~Gradient();
  2012.         virtual void allocateGradientPointers(int anInt);
  2013.         virtual void allocateLinks(int anInt);
  2014.         virtual void constructDLL();
  2015.         virtual void destroyDLL(DLLData *);
  2016.         virtual void fireGetReady();
  2017.         virtual void initializeDLL();
  2018.         virtual const char *dllFunctionName();
  2019.         virtual void loadWeights(FILE *, unsigned short int version=100);
  2020.         virtual void loadStateVariables(FILE *file, unsigned short int version);
  2021.         virtual void saveWeights(FILE *);
  2022.         virtual void saveStateVariables(FILE *file);
  2023.         virtual void networkRandomize(void);
  2024.         void setCriterion(Criterion *aCriterion);
  2025.         virtual void setDLLFunction(DLLStruct *aDLL);
  2026.         void setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  2027.         void setErrorSoma(Soma *aSoma);
  2028.         void setGradient(Gradient *aGradient, int index);
  2029.         virtual void setWeightLimit(NSFloat aFloat);
  2030.         virtual void update(Soma *aSoma);
  2031.         virtual void updateDLL(Soma *aSoma);
  2032.         void updateWeights(Soma *aSoma);
  2033.         NSFloat weightLimit(void) {return maxWeight;};
  2034.         virtual void networkReset(void);
  2035. };
  2036.  
  2037. #endif // __Gradient_H__
  2038.  
  2039. // Author: Wesley Curtis Lefebvre
  2040.  
  2041. #ifndef __Step_H__
  2042. #define __Step_H__
  2043.  
  2044.  
  2045. typedef DLLData *(*Step_Constructor)(DLLData *, int, BOOL);
  2046. typedef DLLData *(*Step_Constructor_CSW)(DLLData *, int, BOOL, void *);
  2047. typedef void (*Step_MAP)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat);
  2048. typedef void (*Step_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, void *);
  2049.  
  2050. class Step: public Gradient {
  2051.         int stepCount;
  2052. protected:
  2053.     NSFloat m_fDefaultStepSize, *stepSize;
  2054.     SpatialAccess *stepAccess;
  2055.     BOOL individualSteps;
  2056.     BOOL m_bDecayWeights;
  2057.     NSFloat m_fDecayRate;
  2058.     int m_nStepDivisor;
  2059.  
  2060. public:
  2061.     Step();
  2062.     void addToStepSize(NSFloat aFloat);
  2063.     void constructDLL();
  2064.     const char *dllFunctionName();
  2065.     NSFloat defaultStepSize(void) { return m_fDefaultStepSize; };
  2066.     void multByStepSize(NSFloat aFloat);
  2067.     virtual void setIndividualSteps(BOOL aFlag);
  2068.     void setDefaultStepSize(NSFloat aFloat);
  2069.     void setDecayRate(NSFloat aFloat) { m_fDecayRate = aFloat; };
  2070.     void setDecayWeights(BOOL aBool) { m_bDecayWeights = aBool; };
  2071.     void setStepAccess(SpatialAccess *anNSAccess);
  2072.     void setStepDivisor(int anInt) { m_nStepDivisor = anInt; };
  2073.     NSFloat &step(int i) { return (individualSteps && (i<stepCount))? *(stepSize+i): *stepSize; };
  2074.     int step(void) { return stepCount; };
  2075.     // Overwritten virtual functions
  2076.     void allocateLinks(int anInt);
  2077.     void networkReset(void);
  2078.     void update(Soma *aSoma);
  2079.     void updateDLL(Soma *aSoma);
  2080.     virtual ~Step(void);
  2081. };
  2082.  
  2083. #endif  // __Step_H__
  2084.  
  2085. #ifndef __SVMStep_H__
  2086. #define __SVMStep_H__
  2087.  
  2088. class SVMStep: public Step {
  2089. protected:
  2090.     int            m_nExemplarCount;
  2091.     BOOL        m_bRunningFirstEpoch;
  2092.  
  2093. public:
  2094.                 SVMStep();
  2095.     void        epochEnded();
  2096.     int            exemplarCount() { return m_nExemplarCount; };
  2097.     void        loadStateVariables(FILE *file, unsigned short int version);
  2098.     void        networkReset();
  2099.     BOOL        runningFirstEpoch() { return m_bRunningFirstEpoch; };
  2100.     void        saveStateVariables(FILE *file);
  2101.     void        setExemplarCount(int anInt) { m_nExemplarCount = anInt; };
  2102.     void        setRunningFirstEpoch(BOOL aBool) { m_bRunningFirstEpoch = aBool; };
  2103.     void        update(Soma *aSoma);
  2104. };
  2105.  
  2106. #endif // __SVMStep_H__
  2107.  
  2108. //ConjugateGradient
  2109.  
  2110. #ifndef __ConjugateGradient_H__
  2111. #define __ConjugateGradient_H__
  2112.  
  2113.  
  2114. //typedef DLLData *(*ConjugateGradient_Constructor)(DLLData *, int, BOOL);
  2115. //typedef DLLData *(*ConjugateGradient_Constructor_CSW)(DLLData *, int, BOOL, void *);
  2116. //typedef void (*ConjugateGradient_MAP)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL);
  2117. //typedef void (*ConjugateGradient_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, void *);
  2118. class CGVars {
  2119. public:
  2120.     int linksAllocated;
  2121.     NSFloat *gradient;
  2122.     NSFloat *StoredWeightOnFireConclude;
  2123.     NSFloat *StoredWeight;
  2124. /*
  2125.     NSFloat *Pvec;
  2126.     NSFloat *Gvec;
  2127.     NSFloat *SKvec;
  2128. */
  2129.     double *Pvec;
  2130.     double *Gvec;
  2131.     double *SKvec;
  2132.  
  2133.     NSFloat *weight;
  2134.  
  2135.     CGVars();
  2136. //    void operator=(CGVars var1);
  2137.     void operator++(void);
  2138.     void store_weight(void);
  2139.     void reload_weight(void);
  2140.     void store_weight_conclude(void);
  2141.     void reload_weight_conclude(void);
  2142.     void store_info(Gradient *);
  2143.  
  2144. };
  2145.  
  2146. class CGGlobals {
  2147. public:
  2148. //    NSFloat Lambda, LambdaBar, MSE, MSEOld, Sigma, SigmaK, AlphaK, MuK, DeltaK;
  2149.     double Lambda, LambdaBar, MSE, MSEOld, Sigma, SigmaK, AlphaK, MuK, DeltaK;
  2150.     BOOL Success,Initialized,checkMSE,WeightsRandomized, weightsStoredOnFireConclude;
  2151.     int NumWeights, EpochNumber;
  2152.     void initializeGlobals(void);
  2153. };
  2154.  
  2155. class ConjugateGradient: public Gradient {
  2156.  
  2157. public:
  2158.         NSFloat *StoredWeightsOnFireConclude;
  2159.         NSFloat *StoredWeights;
  2160. /*
  2161.         NSFloat *Pvec;
  2162.         NSFloat *Gvec;
  2163.         NSFloat *SKvec;
  2164. */
  2165.         double *Pvec;
  2166.         double *Gvec;
  2167.         double *SKvec;
  2168.  
  2169. protected:
  2170.         BOOL m_bMasterGradient;
  2171.         int grad_comp_num;
  2172.         int    m_nActiveNumberOfExemplars;
  2173.  
  2174.         CGVars    m_firstvar_cgvars,
  2175.                 m_firstweight_cgvars;
  2176.  
  2177. public:
  2178.         CGGlobals *cgg;
  2179.         ConjugateGradient();
  2180.         virtual ~ConjugateGradient(void);
  2181. //        void constructDLL();
  2182. //        const char *dllFunctionName();
  2183.         // Overwritten virtual functions
  2184.         void allocateLinks(int anInt);
  2185.         void epochEnded(int counter);
  2186.         void fireGetReady();
  2187.         BOOL masterGradient() { return m_bMasterGradient; };
  2188.         void networkReset(void);
  2189.         void phaseEnded(int counter);
  2190.         void loadStateVariables(FILE *file, unsigned short int version);
  2191.         void saveStateVariables(FILE *file);
  2192.         void setMasterGradient(BOOL aBool);
  2193.         void update(Soma *aSoma);
  2194.         void storeOldWeights(void);
  2195.         void storeOldWeightsOnFireConclude(void);    // I don't think this is needed
  2196.         void reloadOldWeights(void);
  2197.         void reloadOldWeightsOnFireConclude(void);
  2198.         void resetGradients(void);
  2199.         void initializeVariables(void);
  2200.         void setActiveNumberOfExemplars(int anInt) { m_nActiveNumberOfExemplars = anInt; };
  2201.         void networkRandomize(void);
  2202.         void fireConclude(void);
  2203.         CGVars *first_weight(void);
  2204.         CGVars *next_weight(CGVars *);
  2205.         CGVars *first_var(Gradient *);
  2206.         void resetCG(void);
  2207.         friend void CGVars::store_info(Gradient *);
  2208. //        void updateDLL(Soma *aSoma);
  2209. };
  2210.  
  2211. #endif  // __ConjugateGradient_H__
  2212.  
  2213. // Author: Wesley Curtis Lefebvre
  2214.  
  2215. #ifndef __Momentum_H__
  2216. #define __Momentum_H__
  2217.  
  2218.  
  2219. typedef void (*Momentum_MAP)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, NSFloat, NSFloat *);
  2220. typedef void (*Momentum_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, NSFloat, NSFloat *, void *);
  2221.  
  2222. class Momentum: public Step {
  2223. protected:
  2224.         int momentumCount;
  2225.         NSFloat defaultMomentum, *momentumSize, *delta;
  2226.         SpatialAccess *deltaWAccess, *momentumAccess;
  2227.         BOOL individualMomentums;
  2228. public:
  2229.         Momentum();
  2230.         void addToMomentum(NSFloat aFloat);
  2231.         NSFloat &dW(int i) { return *(delta+i); };
  2232.         NSFloat getDefaultMomentum(void) { return defaultMomentum; };
  2233.         NSFloat &momentum(int i) { return individualMomentums? *(momentumSize+i): *momentumSize; };
  2234.         int momentum(void) { return momentumCount; };
  2235.         void multByMomentum(NSFloat aFloat);
  2236.         void loadStateVariables(FILE *file, unsigned short int version);
  2237.         void saveStateVariables(FILE *file);
  2238.         void setDeltaWAccess(SpatialAccess* anNSAccess);
  2239.         virtual void setDefaultMomentum(NSFloat aFloat);
  2240.         virtual void setIndividualMomentums(BOOL aFlag);
  2241.         virtual void setMomentumAccess(SpatialAccess* anNSAccess);
  2242.         // Overwritten virtual functions
  2243.         void allocateLinks(int anInt);
  2244.         const char *dllFunctionName();
  2245.         void networkReset(void);
  2246.         void update(Soma *aSoma);
  2247.         void updateDLL(Soma *aSoma);
  2248.         ~Momentum(void);
  2249. };
  2250.  
  2251. #endif // __Momentum_H__
  2252.  
  2253. // Author: Wesley Curtis Lefebvre
  2254.  
  2255. #ifndef __Quickprop_H__
  2256. #define __Quickprop_H__
  2257.  
  2258.  
  2259. typedef void (*Quickprop_MAP)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, NSFloat *, NSFloat *, NSFloat, NSFloat *);
  2260. typedef void (*Quickprop_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat *, NSFloat *, BOOL, int, BOOL, NSFloat, NSFloat *, NSFloat *, NSFloat, NSFloat *, void *);
  2261.  
  2262. class Quickprop: public Momentum {
  2263.         NSFloat *deltaE;
  2264. protected:
  2265.         SpatialAccess *deltaEAccess;
  2266. public:
  2267.         Quickprop();
  2268.         void setDeltaEAccess(SpatialAccess *);
  2269.         // Overwritten virtual functions
  2270.         void allocateLinks(int anInt);
  2271.         NSFloat &dE(int i) { return *(deltaE+i); };
  2272.         const char *dllFunctionName();
  2273.         void loadStateVariables(FILE *file, unsigned short int version);
  2274.         void saveStateVariables(FILE *file);
  2275.         void setDefaultMomentum(NSFloat aFloat);
  2276.         void update(Soma *aSoma);
  2277.         void updateDLL(Soma *aSoma);
  2278.         void networkReset(void);
  2279.         ~Quickprop(void);
  2280. };
  2281.  
  2282. #endif //__Quickprop_H__
  2283.  
  2284. // Author: Wesley Curtis Lefebvre
  2285.  
  2286. #ifndef __DeltaBarDelta_H__
  2287. #define __DeltaBarDelta_H__
  2288.  
  2289.  
  2290. typedef void (*DeltaBarDelta_MAP)(DLLData *, NSFloat *, int, NSFloat, NSFloat *, NSFloat *, NSFloat *, NSFloat, NSFloat, NSFloat);
  2291. typedef void (*DeltaBarDelta_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat, NSFloat *, NSFloat *, NSFloat *, NSFloat, NSFloat, NSFloat, void *);
  2292.  
  2293. class DeltaBarDelta: public Quickprop {
  2294.         NSFloat kappaValue, betaValue, zetaValue;
  2295. protected:
  2296.         NSFloat &D(int i) { return errorSoma->w(i); };
  2297.         NSFloat &S(int i) { return dE(i); };
  2298.         // Overwritten virtual functions
  2299. public:
  2300.         DeltaBarDelta();
  2301.         const char *dllFunctionName();
  2302.         NSFloat beta() { return betaValue; };
  2303.         NSFloat kappa() { return kappaValue; };
  2304.         NSFloat zeta() { return zetaValue; };
  2305.         void networkReset(void);
  2306.         void setDefaultMomentum(NSFloat);
  2307.         void setIndividualSteps(BOOL aFlag);
  2308.         void setKappa(NSFloat aFloat);
  2309.         void setBeta(NSFloat aFloat);
  2310.         void setZeta(NSFloat aFloat);
  2311.         void update(Soma *aSoma);
  2312.         void updateDLL(Soma *aSoma);
  2313. };
  2314.  
  2315. #endif // __DeltaBarDelta_H__
  2316.  
  2317. // Author: Wesley Curtis Lefebvre
  2318.  
  2319. #ifndef __UnsupervisedFull_H__
  2320. #define __UnsupervisedFull_H__
  2321.  
  2322.  
  2323. typedef void (*Unsupervised_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat);
  2324. typedef void (*Unsupervised_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, void *);
  2325.  
  2326. class UnsupervisedFull: public FullSynapse {
  2327. protected:
  2328.         SpatialAccess *stepAccess;
  2329.         BOOL m_bLearning, m_bTempLearning;
  2330.         NSFloat step, m_fStep;
  2331.         void fireDLL();
  2332.         void fireFeed();
  2333.         virtual void fireRule();
  2334.         virtual void fireRuleDLL();
  2335.         SpatialAccess *forcingAccess;
  2336.         NSFloat *forcingFeed, *feed;
  2337.         BOOL m_bForcing;
  2338.         BOOL m_bWeightNormalize;
  2339.         BOOL m_bLearningOnReset;
  2340. public:
  2341.         UnsupervisedFull();
  2342.         const char *dllFunctionName();
  2343.         BOOL learning() { return m_bLearning; };
  2344.         void networkReset();
  2345.         void setLearningOnReset(BOOL aBOOL) { m_bLearningOnReset = aBOOL; };
  2346.         void setLearning(BOOL aBOOL) { m_bLearning = aBOOL; };
  2347.         void setLearningNO() { m_bTempLearning = m_bLearning; m_bLearning = NO; };
  2348.         void setLearningYES() { m_bLearning = m_bTempLearning;  m_bTempLearning = NO; };
  2349.         void setStepAccess(SpatialAccess *);
  2350.         void setStepSize(NSFloat);
  2351.         NSFloat stepSize() { return step; };
  2352.         void allocateForce(void);
  2353.         void allocateSynapticLinks(void);
  2354.         void fire(void);
  2355.         void setForcing(BOOL);
  2356.         void setForcingAccess(SpatialAccess *);
  2357.         void setWeightNormalize(BOOL aBOOL) { m_bWeightNormalize = aBOOL; };
  2358. };
  2359.  
  2360. #endif // __UnsupervisedFull_H__
  2361.  
  2362. // SVMInputSynapse
  2363.  
  2364. #ifndef __SVMInputSynapse_H__
  2365. #define __SVMInputSynapse_H__
  2366.  
  2367.  
  2368. class SVMInputSynapse: public UnsupervisedFull {
  2369. protected:
  2370.     BOOL    m_bRunningFirstEpoch,
  2371.             m_bDotProductMetric;
  2372.     int        m_nExemplarCount;
  2373.  
  2374. public:
  2375.                 SVMInputSynapse();
  2376.     void        epochEnded();
  2377.     int            exemplarCount() { return m_nExemplarCount; };
  2378.     void        fireFeed(void);
  2379.     void        fireRule(void);
  2380.     void        loadStateVariables(FILE *file, unsigned short int version);
  2381.     void        networkReset();
  2382.     BOOL        runningFirstEpoch() { return m_bRunningFirstEpoch; };
  2383.     void        saveStateVariables(FILE *file);
  2384.     void        setDotProductMetric(BOOL aBool) { m_bDotProductMetric = aBool; };
  2385.     void        setExemplarCount(int anInt) { m_nExemplarCount = anInt; };
  2386.     void        setRunningFirstEpoch(BOOL aBool) { m_bRunningFirstEpoch = aBool; };
  2387. };
  2388.  
  2389. #endif // __SVMInputSynapse_H__
  2390.  
  2391. // Author: Wesley Curtis Lefebvre
  2392.  
  2393. #ifndef __HebbianFull_H__
  2394. #define __HebbianFull_H__
  2395.  
  2396.  
  2397. class HebbianFull: public UnsupervisedFull {
  2398. protected:
  2399. //        SpatialAccess *forcingAccess;
  2400. //        NSFloat *forcingFeed, *feed;
  2401. //        BOOL m_bForcing;
  2402. public:
  2403.         HebbianFull();
  2404. //        void allocateForce(void);
  2405. //        void allocateSynapticLinks(void);
  2406. //        void fire(void);
  2407.         void fireRule(void);
  2408.         void fireRuleDLL();
  2409. //        void HebbianFull::setForcing(BOOL);
  2410. //        void setForcingAccess(SpatialAccess *);
  2411.         void storeHopfield(int);
  2412. };
  2413.  
  2414. #endif // __HebbianFull_H__
  2415.  
  2416. // Author: Wesley Curtis Lefebvre
  2417.  
  2418. #ifndef __OjasFull_H__
  2419. #define __OjasFull_H__
  2420.  
  2421.  
  2422. class OjasFull: public UnsupervisedFull {
  2423. protected:
  2424.         void fireRule(void);
  2425. };
  2426.  
  2427. #endif // __OjasFull_H__
  2428.  
  2429. // Author: Wesley Curtis Lefebvre
  2430.  
  2431. #ifndef __SangersFull_H__
  2432. #define __SangersFull_H__
  2433.  
  2434.  
  2435. class SangersFull: public UnsupervisedFull {
  2436. protected:
  2437.         void fireRule(void);
  2438. };
  2439.  
  2440. #endif // __SangersFull_H__
  2441.  
  2442. // Author: Wesley Curtis Lefebvre
  2443.  
  2444. #ifndef __CompetitiveFull_H__
  2445. #define __CompetitiveFull_H__
  2446.  
  2447.  
  2448. typedef enum {DotProduct=0, Euclidean=1, BoxCar=2} NMetricType;
  2449. typedef void (*Competitive_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, int);
  2450. typedef void (*Competitive_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, int, void *);
  2451.  
  2452. class CompetitiveFull: public UnsupervisedFull {
  2453. protected:
  2454.         NMetricType                    m_eMetricType;
  2455.         int                            winningIndex,
  2456.                                     m_nNumSamples;
  2457.         SpatialAccess                *unifiedDistanceAccess,
  2458.                                     *quantizationMetricAccess;
  2459.         NSFloat                        *m_fpDistanceMatrix;
  2460.         NSFloat                        m_fQuantizationMetric,
  2461.                                     m_fSumError;
  2462.  
  2463. public:
  2464.         CompetitiveFull();
  2465.         NSFloat distance(int r1, int c1, int r2, int c2, NSFloat *input, int koh_cols, int orig_cols);
  2466.         const char *dllFunctionName();
  2467.         void epochEnded();
  2468.         void fireDLL();
  2469.         void fireFeed();
  2470.         void fireRule();
  2471.         virtual void fireWinner();
  2472.         virtual void fireWinnerDLL();
  2473.         void linksAltered(void);
  2474.         void networkReset();
  2475.         NMetricType metric() { return m_eMetricType; };
  2476.         void setMetric(NMetricType anEnum) { m_eMetricType = anEnum; };
  2477.         void setQuantizationMetricAccess(SpatialAccess *anId);
  2478.         void setUnifiedDistanceAccess(SpatialAccess *anId);
  2479. };
  2480.  
  2481. #endif // __CompetitiveFull_H__
  2482.  
  2483. // Author: Wesley Curtis Lefebvre
  2484.  
  2485. #ifndef __StandardFull_H__
  2486. #define __StandardFull_H__
  2487.  
  2488.  
  2489. class StandardFull: public CompetitiveFull {
  2490. protected:
  2491.         void standardUpdate(int i, int j) { W(i, j) += step * (V(j) - W(i, j)); };
  2492.         void fireWinner(void);
  2493. };
  2494.  
  2495. #endif // __StandardFull_H__
  2496.  
  2497. // Author: Wesley Curtis Lefebvre
  2498.  
  2499. #ifndef __ConscienceFull_H__
  2500. #define __ConscienceFull_H__
  2501.  
  2502.  
  2503. class ConscienceFull: public StandardFull {
  2504. protected:
  2505.         class SpatialData       *frequency, *bias;
  2506.         NSFloat                         m_fBeta, m_fGamma;
  2507.         BOOL                    m_bBiasDataLocal, m_bFrequencyDataLocal;
  2508. public:
  2509.         ConscienceFull();
  2510.         ~ConscienceFull();
  2511.         void allocateSynapticLinks();
  2512.         NSFloat beta() { return m_fBeta; };
  2513.         void fireRule(void);
  2514.         NSFloat gamma() { return m_fGamma; };
  2515.         void networkReset();
  2516.         void setBeta(NSFloat aFloat) { m_fBeta = aFloat; };
  2517.         void setBiasData(SpatialData *);
  2518.         void setFrequencyData(SpatialData *);
  2519.         void setGamma(NSFloat aFloat) { m_fGamma = aFloat; };
  2520. };
  2521.  
  2522. #endif // __ConscienceFull_H__
  2523.  
  2524. // Author: Wesley Curtis Lefebvre
  2525.  
  2526. #ifndef __KohonenFull_H__
  2527. #define __KohonenFull_H__
  2528.  
  2529.  
  2530. typedef void (*Kohonen_MAP)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, int, int, int);
  2531. typedef void (*Kohonen_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat *, int, int, NSFloat *, NSFloat, int, int, int, void *);
  2532.  
  2533. class KohonenFull: public ConscienceFull {
  2534. protected:
  2535.         SpatialAccess           *neighborhoodAccess,
  2536.                                 *componentPlaneAccess;
  2537.         NSFloat                 m_fNeighborhood;
  2538.         NSFloat                 *m_fpComponentPlaneMatrix;
  2539.         int                        m_iNeighborhood;
  2540.         int                     startRow, stopRow, m_nComponentPlane,
  2541.                                 startCol, stopCol,
  2542.                                 winningRow, winningCol;
  2543. public:
  2544.         KohonenFull();
  2545.         int componentPlane();
  2546.         const char *dllFunctionName();
  2547.         void epochEnded();
  2548.         void linksAltered(void);
  2549.         int neighborhood() { return (int)m_fNeighborhood; };
  2550.         void networkReset();
  2551.         void setNeighborhood(int);
  2552.         void setNeighborhoodAccess(SpatialAccess *);
  2553.         void fireWinner();
  2554.         void fireWinnerDLL();
  2555.         virtual void fireWinningShape();
  2556.         void setComponentPlane(int anInt);
  2557.         void setComponentPlaneAccess(SpatialAccess *anId);
  2558. };
  2559.  
  2560. #endif // __KohonenFull_H__
  2561.  
  2562. // Author: Wesley Curtis Lefebvre
  2563.  
  2564. #ifndef __LineKohonenFull_H__
  2565. #define __LineKohonenFull_H__
  2566.  
  2567.  
  2568. class LineKohonenFull: public KohonenFull {
  2569. protected:
  2570.         void fireWinner();
  2571. };
  2572.  
  2573. #endif // __LineKohonenFull_H__
  2574.  
  2575. // Author: Wesley Curtis Lefebvre
  2576.  
  2577. #ifndef __SquareKohonenFull_H__
  2578. #define __SquareKohonenFull_H__
  2579.  
  2580.  
  2581. class SquareKohonenFull: public KohonenFull {
  2582. protected:
  2583.         void fireWinningShape();
  2584. };
  2585.  
  2586. #endif  __SquareKohonenFull_H__
  2587.  
  2588. // Author: Wesley Curtis Lefebvre
  2589.  
  2590. #ifndef __DiamondKohonenFull_H__
  2591. #define __DiamondKohonenFull_H__
  2592.  
  2593.  
  2594. class DiamondKohonenFull: public KohonenFull {
  2595. protected:
  2596.         void fireWinningShape();
  2597. };
  2598.  
  2599. #endif  __DiamondKohonenFull_H__
  2600.  
  2601. // Author: Wesley Curtis Lefebvre
  2602. // Name: Transmitter.h
  2603.  
  2604. #ifndef __Transmitter_H__
  2605. #define __Transmitter_H__
  2606.  
  2607.  
  2608. typedef BOOL (*Transmitter_MAP)(DLLData *, NSFloat *, int);
  2609. typedef BOOL (*Transmitter_MAP_CSW)(DLLData *, NSFloat *, int, void *);
  2610. typedef void (*TransmitterSend_FUNCTION)(void *, const char *);
  2611.  
  2612. class Transmitter: public SpatialData
  2613. {
  2614. protected:
  2615.         DLLStruct *dllStruct;
  2616.         void *m_pSendFunction;
  2617.         void *m_pCallingObject;
  2618.         unsigned int receiverCount;
  2619.         char *receiverName[128];
  2620.         void *receiverID[128];
  2621. public:
  2622.         Transmitter();
  2623.         ~Transmitter();
  2624.         void addReceiver(void *anId, const char *);
  2625.         virtual void constructDLL(void);
  2626.         virtual void destroyDLL(DLLData *);
  2627.         virtual void initializeDLL(void);
  2628.         void reportSpatialData();
  2629.         virtual void sendTransmitterActions();
  2630.         virtual void setDLLFunction(DLLStruct *);
  2631.         virtual void setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  2632.         void setSendFunction(void *aFunction);
  2633.         virtual BOOL shouldTransmit(NSFloat *someData);
  2634.         virtual BOOL shouldTransmitDLL(NSFloat *someData);
  2635. };
  2636.  
  2637. #endif __Transmitter_H__
  2638.  
  2639. // Author: Wesley Curtis Lefebvre
  2640. // Name: ThresholdTransmitter.h
  2641.  
  2642. #ifndef __ThresholdTransmitter_H__
  2643. #define __ThresholdTransmitter_H__
  2644.  
  2645.  
  2646. typedef DLLData *(*ThresholdTransmitter_Constructor)(DLLData *, int, int);
  2647. typedef DLLData *(*ThresholdTransmitter_Constructor_CSW)(DLLData *, int, int, void *);
  2648. typedef BOOL (*ThresholdTransmitter_MAP)(DLLData *, NSFloat *, int, int, NSFloat, BOOL, int, int);
  2649. typedef BOOL (*ThresholdTransmitter_MAP_CSW)(DLLData *, NSFloat *, int, int, NSFloat, BOOL, int, int, void *);
  2650.  
  2651. class ThresholdTransmitter: public Transmitter
  2652. {
  2653. protected:
  2654.         class   SpatialAccess    *m_thresholdAccess;
  2655.         class   SpatialData        *m_pSmooth;
  2656.         NSFloat                    m_threshold,
  2657.                                 m_thresholdDecay,
  2658.                                 m_fBeta,
  2659.                                 m_fInitialValue,
  2660.                                 m_startingThreshold;
  2661.         int                        m_sendAfter, m_sendAfterCounter, m_thresholdType, m_nChannelNumber;
  2662.         BOOL                    m_bSmoothingDataLocal, m_lessThan, m_bMultBy, m_bAbs;
  2663. public:
  2664.                                 ThresholdTransmitter();
  2665.                                 ~ThresholdTransmitter();
  2666.         NSFloat                    absolute(NSFloat &aFloat) { return m_bAbs? (NSFloat)fabs(aFloat): aFloat; };
  2667.         BOOL                    absoluteValue() { return m_bAbs; };
  2668.         BOOL                    allLessThan(NSFloat *data,int length);
  2669.         BOOL                    averageLessThan(NSFloat *data,int length);
  2670.         NSFloat                    beta(){return m_fBeta;};
  2671.         void                    constructDLL();
  2672.         NSFloat                    initialValue(){return m_fInitialValue;};
  2673.         BOOL                    lessThan(){return m_lessThan;};
  2674.         BOOL                    multBy(){return m_bMultBy;};
  2675.         void                    networkReset();
  2676.         BOOL                    oneLessThan(NSFloat *data,int length);
  2677.         BOOL                    overThreshold(NSFloat *someData);
  2678.         int                        sendAfter(){return m_sendAfter;};
  2679.         void                    sendTransmitterActions();
  2680.         void                    setAbsoluteValue(BOOL aBOOL) { m_bAbs = aBOOL; };
  2681.         void                    setBeta(NSFloat aFloat) { m_fBeta = aFloat; };
  2682.         void                    setChannelNumber(int anInt);
  2683.         void                    setInitialValue(NSFloat aFloat);
  2684.         void                    setData(NSFloat *aFloat, int rows, int cols=1);
  2685.         void                    setSpatialDimension(int, int);
  2686.         void                    setLessThan(BOOL aFlag);
  2687.         void                    setMultBy(BOOL aFlag);
  2688.         void                    setSendAfter(int anInt);
  2689.         void                    setSmoothingData(SpatialData *);
  2690.         void                    setThreshold(NSFloat aFloat);
  2691.         void                    setThresholdDecay(NSFloat aFloat);
  2692.         void                    setThresholdType(int anInt);
  2693.         void                    setThresholdAccess(SpatialAccess *);
  2694.         BOOL                    shouldTransmit(NSFloat *);
  2695.         BOOL                    shouldTransmitDLL(NSFloat *);
  2696.         NSFloat                    threshold(){return m_startingThreshold;};
  2697.         NSFloat                    thresholdDecay(){return m_thresholdDecay;};
  2698.         int                        thresholdType(){return m_thresholdType;};
  2699.         virtual NSFloat            *weightedAverage(NSFloat *);
  2700. };
  2701. #endif
  2702.  
  2703. // Author: Wesley Curtis Lefebvre
  2704. // Name: DeltaTransmitter.h
  2705.  
  2706. #ifndef __DeltaTransmitter_H__
  2707. #define __DeltaTransmitter_H__
  2708.  
  2709.  
  2710. class DeltaTransmitter: public ThresholdTransmitter
  2711. {
  2712. protected:
  2713.                 NSFloat                 *m_lastData, *m_deltaData;
  2714. public:
  2715.  
  2716.                                         DeltaTransmitter();
  2717.                                         ~DeltaTransmitter();
  2718.                 DeltaTransmitter        *allocateLastData();
  2719.                 NSFloat                 *weightedAverage(NSFloat *);
  2720.                 void                    setData(NSFloat *, int, int cols=1);
  2721.                 void                    setSpatialDimension(int, int);
  2722.  
  2723. };
  2724.  
  2725. #endif __DeltaTransmitter_H__
  2726.  
  2727. #ifndef __Scheduler_H__
  2728. #define __Scheduler_H__
  2729.  
  2730.  
  2731. typedef DLLData *(*Scheduler_Constructor)(DLLData *, int);
  2732. typedef DLLData *(*Scheduler_Constructor_CSW)(DLLData *, int, void *);
  2733. typedef void (*Scheduler_MAP)(DLLData *, NSFloat *, int, NSFloat);
  2734. typedef void (*Scheduler_MAP_CSW)(DLLData *, NSFloat *, int, NSFloat, void *);
  2735.  
  2736. class Scheduler : public SpatialData
  2737. {
  2738. protected:
  2739.         NSFloat                         m_fBeta, m_fMin, m_fMax;
  2740.         int                             m_iStart, m_iStop;
  2741.         DLLStruct                       *dllStruct;
  2742.         void                            *m_pCallingObject;
  2743. public:
  2744.                                                 Scheduler();
  2745.         virtual void            applyDLL();
  2746.         virtual void            applySchedule(){};
  2747.         void                            attachTo(SpatialAccess *);
  2748.         NSFloat                         beta() { return m_fBeta; };
  2749.         void                            constrain(NSFloat &f) { if (f>m_fMax) f=m_fMax; else if (f<m_fMin) f=m_fMin; };
  2750.         const char                      *dllFunctionName();
  2751.         void                            epochEnded(int);
  2752.         void                            constructDLL();
  2753.         void                            destroyDLL(DLLData *);
  2754.         void                            initializeDLL();
  2755.         NSFloat                         maximum() { return m_fMax; };
  2756.         NSFloat                         minimum() { return m_fMin; };
  2757.         void                            setBeta(NSFloat aFloat) { m_fBeta = aFloat; };
  2758.         void                            setData(NSFloat *, int, int);
  2759.         void                            setDLL(void *function, void *constructor=NULL, void *destructor=NULL, void *instance=NULL, void *callingObject=NULL);
  2760.         void                            setMaximum(NSFloat aFloat) { m_fMax = aFloat; };
  2761.         void                            setMinimum(NSFloat aFloat) { m_fMin = aFloat; };
  2762.         void                            setSpatialDimension(int, int);
  2763.         void                            setStart(int anInt) { m_iStart = anInt; };
  2764.         void                            setStop(int anInt) { m_iStop = anInt; };
  2765.         int                                     start() { return m_iStart; };
  2766.         int                                     stop() { return m_iStop; };
  2767. };
  2768.  
  2769. #endif __Scheduler_H__
  2770.  
  2771. // Author: Wesley Curtis Lefebvre
  2772.  
  2773. #ifndef __ExpScheduler_H__
  2774. #define __ExpScheduler_H__
  2775.  
  2776.  
  2777. class ExpScheduler : public Scheduler
  2778. {
  2779. public:
  2780.                                 ExpScheduler();
  2781.         void            applySchedule();
  2782. };
  2783.  
  2784. #endif __ExpScheduler_H__
  2785.  
  2786. // Author: Wesley Curtis Lefebvre
  2787.  
  2788. #ifndef __LogScheduler_H__
  2789. #define __LogScheduler_H__
  2790.  
  2791.  
  2792. class LogScheduler : public Scheduler
  2793. {
  2794. public:
  2795.                                 LogScheduler();
  2796.         void            applySchedule();
  2797. };
  2798.  
  2799. #endif __LogScheduler_H__
  2800.  
  2801. // Author: Wesley Curtis Lefebvre
  2802.  
  2803. #ifndef __LinearScheduler_H__
  2804. #define __LinearScheduler_H__
  2805.  
  2806.  
  2807. class LinearScheduler : public Scheduler
  2808. {
  2809. public:
  2810.                                 LinearScheduler();
  2811.         void            applySchedule();
  2812. };
  2813.  
  2814. #endif __LinearScheduler_H__
  2815.